lamajlooc Posted October 25, 2006 Share Posted October 25, 2006 First, I'd like to say thanks to all those who responded to my other two questions. Here's one that's bizarre though.I'm getting an error on the following code:$result = @mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); if ($row) { $_SESSION['date_last_in'] = $row[0]; }The error is "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource"The wierd things are: a) according to php.net the syntax is CORRECT (unless I'm syslexic) and I've used this same code before with no troubles.Any ideas? Link to comment https://forums.phpfreaks.com/topic/25021-some-help-identifying-the-bad-syntax-please/ Share on other sites More sharing options...
Stooney Posted October 25, 2006 Share Posted October 25, 2006 [code]$result = @mysql_query ($query);if($result) { $row = mysql_fetch_array ($result, MYSQL_NUM); if ($row) { $_SESSION['date_last_in'] = $row[0]; }}else{ //query didn't work, therefore $result is not a "valid MySQL result resource"}[/code]Basically you need to make sure you're connected with your database properly and that your query is valid. Link to comment https://forums.phpfreaks.com/topic/25021-some-help-identifying-the-bad-syntax-please/#findComment-114030 Share on other sites More sharing options...
BrianPeiris Posted October 25, 2006 Share Posted October 25, 2006 you might also want to remove the '@' (at sign) in front of 'mysql_query' during testing, so that you see any and all errors that might be suppressed. Docs on Error Control Operators:[url=http://|http://ca3.php.net/manual/en/language.operators.errorcontrol.php]|http://ca3.php.net/manual/en/language.operators.errorcontrol.php[/url] Link to comment https://forums.phpfreaks.com/topic/25021-some-help-identifying-the-bad-syntax-please/#findComment-114069 Share on other sites More sharing options...
JasonLewis Posted October 25, 2006 Share Posted October 25, 2006 whats the query to btw...? Link to comment https://forums.phpfreaks.com/topic/25021-some-help-identifying-the-bad-syntax-please/#findComment-114112 Share on other sites More sharing options...
lamajlooc Posted October 25, 2006 Author Share Posted October 25, 2006 Fixed the problem, I was dyslexic. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/25021-some-help-identifying-the-bad-syntax-please/#findComment-114492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.