Jump to content

SQL errors


kkroo

Recommended Posts

I created an automatic backup script, and occasionally, i will get some errors like:

FAILED IN get_table_def (show keys) on line372 in/home/***/public_html/forum/includes/auto_backup.php
SHOW KEYS FROM

Failed in get_table_def (show fields) on line337 in/home/***/public_html/gcc/forum/includes/auto_backup.php
SHOW FIELDS FROM

Failed in get_table_content (select *) on line535 in/home/**/public_html/gcc/forum/includes/auto_backup.php
SELECT * FROM

i added a filter to see if the var is empty, and it passes, so i think it may be a syntax error

this is the way the query looks like: SELECT * FROM table_name
SHOW KEYS FROM table_name

does it maybe have to be like this: SELECT * FROM `table_name`
SHOW KEYS FROM `table_name`
here is the script:

[a href=\"http://phpbb-login.sourceforge.net/forum/dload.php?action=file&file_id=13\" target=\"_blank\"]http://phpbb-login.sourceforge.net/forum/d...file&file_id=13[/a]

Any help will be highly appreciated
Link to comment
https://forums.phpfreaks.com/topic/10241-sql-errors/
Share on other sites

the script is pretty complex (almost 800 lines) and the specific error is never reported. I looked at the code and didn't find anything until I got to line 535
[code]
        email_message_die("Failed in get_table_content (select *)", "", __LINE__, __FILE__, "SELECT * FROM $table;");
[/code]

it's dumping your query as the error message (or so it would appear). The query is "SELECT * FROM" -- which appears to be missing the $table variable. 535 is inside a function called get_table_content_mysql() -- the function expects to receive $table when called -- but I can't find where the function is called!
Link to comment
https://forums.phpfreaks.com/topic/10241-sql-errors/#findComment-38306
Share on other sites

oops, my bad --- not supposed to use that at all.

[!--quoteo(post=376438:date=May 23 2006, 02:02 PM:name=kkroo)--][div class=\'quotetop\']QUOTE(kkroo @ May 23 2006, 02:02 PM) [snapback]376438[/snapback][/div][div class=\'quotemain\'][!--quotec--]
so just add `` around all occurances of $table in queries? BTW, is it manditory to have the ; at the end of a query?
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/10241-sql-errors/#findComment-38346
Share on other sites

[!--quoteo(post=376438:date=May 23 2006, 12:02 PM:name=kkroo)--][div class=\'quotetop\']QUOTE(kkroo @ May 23 2006, 12:02 PM) [snapback]376438[/snapback][/div][div class=\'quotemain\'][!--quotec--]
so just add `` around all occurances of $table in queries? BTW, is it manditory to have the ; at the end of a query?
[/quote]
Theoretically, ";" is needed to indicate the end of a query, but in php, it's not mandatory.
Link to comment
https://forums.phpfreaks.com/topic/10241-sql-errors/#findComment-38349
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.