🔒 Locked
PHP error
Advertisement
Original Post
Could you please post the lines above this as well? Up to the query?
I think the error is quite clear. $query is not valid. Come on, if you learn 1+1 you surely should know what 1+1+1 would be.
--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
As aforementioned, $query is invalid. No need to post the code preceding this line.
In order to debug your code easier try using something like this right after the query is made:
if (!$query)
{
die(''Query failed: ''.mysql_error());
}
If the query has an error, then $query will return false. This if statement determines if there is a nerror and reports it, then terminates the script if there is an error. I hope this helps.
In order to debug your code easier try using something like this right after the query is made:
if (!$query)
{
die(''Query failed: ''.mysql_error());
}
If the query has an error, then $query will return false. This if statement determines if there is a nerror and reports it, then terminates the script if there is an error. I hope this helps.
Actually its not the query first off. The actual function is mysql_num_rows. However its not to wise to put the actual query in a function like that.
Try This:
$connection = mysql_connect( "$dbhost", "$dbuser", "$dbpass");
$query = mysql_query("QUERY GOES HERE");
$results = mysql_query($query, $connection) OR DIE ("Error in query: $query. " . mysql_error());
Then use:
$num = mysql_num_rows ( $results );
That works. Hope it helps ya.
Chip Lambert
President/Lead Programmer LambertSoft
[edited by - Chip on June 7, 2004 10:09:43 AM]
Try This:
$connection = mysql_connect( "$dbhost", "$dbuser", "$dbpass");
$query = mysql_query("QUERY GOES HERE");
$results = mysql_query($query, $connection) OR DIE ("Error in query: $query. " . mysql_error());
Then use:
$num = mysql_num_rows ( $results );
That works. Hope it helps ya.
Chip Lambert
President/Lead Programmer LambertSoft
[edited by - Chip on June 7, 2004 10:09:43 AM]
quote:
Original post by Chip
Try This:
$connection = mysql_connect( "$dbhost", "$dbuser", "$dbpass");
$query = mysql_query("QUERY GOES HERE");
$results = mysql_query($query, $connection) OR DIE ("Error in query: $query. " . mysql_error());
That''s quite bizarre and wrong. You wouldn''t pass the result of mysql_query to another mysql_query.
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement