Author Topic: DB Error: Bad SQL Query - Image upload  (Read 12182 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
DB Error: Bad SQL Query - Image upload
« on: June 24, 2005, 02:54:27 PM »
Can anyone help me with this one...

Quote
when I or any other member is trying to upload image in gallery we get this error:
DB Error: Bad SQL Query: SELECT user_limit FROM 4images_users WHERE user_id =
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 
DB Error: Bad SQL Query: SELECT COUNT(*) AS num_rows_all FROM 4images_images WHERE image_active = 1 AND user_id= AND image_date > 1119087504
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND image_date > 1119087504' at line 3
Image added: test Luc (1312686213.jpg)
 

That error doesn't effect on image upload, but it confuses all other members.  :?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: DB Error: Bad SQL Query - Image upload
« Reply #1 on: June 25, 2005, 09:32:01 AM »
it must be something "custom" u've added...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: DB Error: Bad SQL Query - Image upload
« Reply #2 on: June 29, 2005, 10:24:24 PM »
I don't know why, becouse I didn't do any changes.

I have installed year ago this mod  [Mod] User upload limits:
http://www.4homepages.de/forum/index.php?topic=3607.0

And this is the code from functions which is almost the same:

Code: [Select]
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 48;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: DB Error: Bad SQL Query - Image upload
« Reply #3 on: June 30, 2005, 12:13:32 AM »
please continue discuss any issues regarding that mod under the mod's topic, your issue is obviosly result of incorrect/false code from that mod.

P.S. try to replace $user_info['user_id'] in this line:
Code: [Select]
if (!check_daily_picture_limit($user_info['user_id']))) {with $user_id (or opposite)

[topic locked]
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)