![]() |
SQL fetch Errors?
Could one of the programming types give me a hand with this error that i am getting running a script on my server...
Quote:
Quote:
174 & 175 line: Code:
$query="SELECT COUNT(*) FROM $table_name"; Code:
$i=0; |
$table_name is not defined, or that table doesn't exist at all, or is perhaps corrupted... or perhaps you have wrong db credentials in your config file...
if you want me to take a closer look for a few bucks, icq: 33375924 or woj#at#wojfun#.#com |
Try backing up and restoring the database tables again. Also note that 'warning' messages can be turned off in PHP configuration (debug mode), they are not errors which will halt your script.
|
I just repaired the SQL table and that seems to have fixed it for a few minutes.
Im now thinking there is an issue with my hosting companies SQL system perhaps? Every time i run the program, if i 'repair' the table afterwards it works again. |
At those lines the warning appears, change mysql_fetch_array to @mysql_fetch_array
It will make it silent. |
Quote:
what good is making it silent if he needs for debugging assuming its not a live site and if it is a live site then set display_errors off in php config and then check error log, but add some code to handle that issue checking the result var Also you should move away from mysql library at the very least use mysqli. The Mysql lib will be deprecated in php's future and its an old library that lacks support in many things |
Well after getting on the phone with the host, it appears the error was with them blocking the server IP address from writing to SQL.
No idea how or why this happened, but the problem is now fixed and the script is working as it should be. Thanks all for the assistance with this issue, its appreciated :) |
You need to CAST the count to a named variable...
Code:
$query="SELECT COUNT(*) AS numrows FROM $table_name"; ...glad you got it sorted out. |
All times are GMT -7. The time now is 11:11 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123