DrFishNips Posted July 2, 2009 Share Posted July 2, 2009 I'm getting this error when I use this query SELECT * FROM potg_articles WHERE uploader='$member' ORDER BY id it says Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 28 in /var/www/potg/members/articles.php on line 59 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 28 in /var/www/potg/members/articles.php on line 60 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 28 in /var/www/potg/members/articles.php on line 61 Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 28 in /var/www/potg/members/articles.php on line 62 when I echo $num it says 1 but there are no entries in the DB that match the query. Any ideas what might be wrong? Link to comment https://forums.phpfreaks.com/topic/164456-solved-mysql-num-rows-telling-me-there-is-1-row-when-there-are-none/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2009 Share Posted July 2, 2009 Cannot really help you without seeing the code from the query to and including the code generating the errors. Link to comment https://forums.phpfreaks.com/topic/164456-solved-mysql-num-rows-telling-me-there-is-1-row-when-there-are-none/#findComment-867484 Share on other sites More sharing options...
DrFishNips Posted July 2, 2009 Author Share Posted July 2, 2009 Sorry heres the PHP http://pastebin.com/mdbf6e98 If there is 1 entry mysql_num_rows says its 1 and if there are 2 it says its 2 etc. the problem only emerges when there are no rows. It says there is 1 for some reason. Link to comment https://forums.phpfreaks.com/topic/164456-solved-mysql-num-rows-telling-me-there-is-1-row-when-there-are-none/#findComment-867494 Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2009 Share Posted July 2, 2009 Both of the following lines of code are assigning a value to $num, not testing if $num is equal to the value - elseif ($num = 1) { echo "You have uploaded <b>$num</b> article.\n\n"; } elseif ($num = 0) { echo "You have not uploaded any article.\n\n"; } Two == signs is an equal comparison, one = sign is an assignment operator. Link to comment https://forums.phpfreaks.com/topic/164456-solved-mysql-num-rows-telling-me-there-is-1-row-when-there-are-none/#findComment-867503 Share on other sites More sharing options...
DrFishNips Posted July 2, 2009 Author Share Posted July 2, 2009 Ah right. I was actually gonna look up the difference between 1 and 2 = signs today. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/164456-solved-mysql-num-rows-telling-me-there-is-1-row-when-there-are-none/#findComment-867506 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.