Author Topic: Bad SQL Query  (Read 3274 times)

0 Members and 1 Guest are viewing this topic.

Offline Smeldraper

  • Pre-Newbie
  • Posts: 4
    • View Profile
Bad SQL Query
« on: June 21, 2011, 12:34:00 PM »
I know this is something about one of the many Mods I did to the code and yes I do have a back ups.  I have also been working late at night and it is probably the most obvious error on my part but maybe a new set of eyes can see the problem. 

I get an error when a user tries to upload an new image.  It says it originates in the member.php file.

Here is the error:
Quote
DB Error: Bad SQL Query: INSERT INTO 4images_images (cat_id, user_id, image_name, image_description, image_keywords, image_date, 1308652080, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments) VALUES (231, 1, 'Image 1', 'Leave a comment.', 'hidding', 1308652080, 1, '11155_cub3_3.jpg', '11155_cub3_3.jpg', '', 1)
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 '1308652080, image_active, image_media_file, image_thumb_file, image_download_url' at line 2

I am attaching the member.php file.

Thanks for the help.

Rembrandt

  • Guest
Re: Bad SQL Query
« Reply #1 on: June 22, 2011, 08:20:07 AM »
you have two errors in your member.php, in your SQL statement:

--------------------------------------------------------------
     $sql = "INSERT INTO ".IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, $current_time, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, $image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";
-------------------------------------------------------------

the same in the "$sql = "INSERT INTO ".IMAGES_TEMP_TABLE.".........."

mfg Andi

Offline Smeldraper

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Bad SQL Query
« Reply #2 on: June 22, 2011, 11:34:45 AM »
Thank you so much...always takes some fresh eyes to see the little things.  I been pouring over the code so much lately that it has given me headaches and so I decided to take a break and see if somebody else could see something.