Author Topic: DB Error: Bad SQL Query \ Supplied Argument is not Valid  (Read 6073 times)

0 Members and 1 Guest are viewing this topic.

Offline killingcurse

  • Pre-Newbie
  • Posts: 4
    • View Profile
DB Error: Bad SQL Query \ Supplied Argument is not Valid
« on: November 08, 2009, 05:34:19 PM »
At some point during the night, something happened to my gallery and I'm not entirely sure what, or how to go about fixing it. Here are the errors displayed at the top of the page:

Quote
An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

DB Error: Bad SQL Query: SELECT a.cat_id, a.auth_viewcat, a.auth_viewimage, a.auth_download, a.auth_upload, a.auth_directupload, a.auth_vote, a.auth_sendpostcard, a.auth_readcomment, a.auth_postcomment FROM (gal_groupaccess a, gal_groupmatch m) WHERE m.user_id = 1 AND a.group_id = m.group_id AND m.groupmatch_startdate <= 1257694610 AND (groupmatch_enddate > 1257694610 OR groupmatch_enddate = 0)
Table 'web27-monagal.gal_groupaccess' doesn't exist

DB Error: Bad SQL Query: SELECT COUNT(*) as total_images FROM gal_images WHERE image_active = 1 AND cat_id NOT IN (0)
Table 'web27-monagal.gal_images' doesn't exist

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM (gal_images i, gal_categories c) LEFT JOIN gal_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 3
Table 'web27-monagal.gal_images' doesn't exist

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/monaj.net/public_html/gallery/includes/db_mysql.php on line 116

- I am running 1.7.6
- I am unable to get into the admin panel with these errors
- I have downloaded the file from data/database/default for reference, but not sure what I have to do with it at the moment.
- I have searched for this error, and most of what I find says to recreate the tables. But the last error makes me think there is more to it than that. And in regards to recreating the tables, how would I go about making it see the content that's already there (i.e. the data for the images that have already been uploaded). The last 'backup' we did was some months ago, which was I believe extremely stupid on our parts, unless the relavent information for that is in the data/database/default sql file.

Rembrandt

  • Guest
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #1 on: November 08, 2009, 06:33:33 PM »
Hi!
the table prefix "gal_"  doesn't exist in your database.
the cms search e.g. "gal_images" "gal_groupmatch" but the prefix  doesn't exist in your database.

set the correct prefix in global.php:
Code: [Select]
$table_prefix = "4images_";
mfg Andi

Offline killingcurse

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #2 on: November 08, 2009, 09:42:43 PM »
The prefix set in global.php is 4images_.
Do I need to change it to the gal_ it's mentioning, or leave it as is.

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 \ Supplied Argument is not Valid
« Reply #3 on: November 08, 2009, 10:22:31 PM »
you should not touch global.php, database prefix should be set in config.php
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)

Rembrandt

  • Guest
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #4 on: November 08, 2009, 10:24:00 PM »
Do I need to change it to the gal_ it's mentioning, or leave it as is.
look what there is in your database.

Offline killingcurse

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #5 on: November 09, 2009, 03:13:04 PM »
The prefixes of all the tables in the gallery are "gal_name", and it is set to "gal_" in the config file.

Rembrandt

  • Guest
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #6 on: November 09, 2009, 04:20:23 PM »
? and in the database?

Offline killingcurse

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: DB Error: Bad SQL Query \ Supplied Argument is not Valid
« Reply #7 on: November 09, 2009, 04:24:58 PM »
The table prefixes for the gallery in the database are "gal_"