suttercain Posted October 17, 2007 Share Posted October 17, 2007 Hi everyone, I have this basic while loop that is not working : <?php $query = mysql_query("SELECT * FROM comicArt") or die(mysql_error()); echo mysql_num_rows($query);//Echoes 1, which is correct while ($row = mysql_fetch_array($query)) { echo "Hello....!"; //but this does not echo } ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 Are you sure there are any rows in your comicArt table? Quote Link to comment Share on other sites More sharing options...
suttercain Posted October 17, 2007 Author Share Posted October 17, 2007 Hi pocobueno1388 Yeah there is one row, and I verified this using the mysql_num_rows and it echoed 1. SC Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 I'm pretty sure that mysql_num_rows will echo out 1 even if there isn't any rows. I would go physically check the database. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 17, 2007 Share Posted October 17, 2007 This is marked "solved", but I don't see a solution given. Will the OP please let everyone know the resolution. Ken Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 17, 2007 Share Posted October 17, 2007 I'm pretty sure that mysql_num_rows will echo out 1 even if there isn't any rows. yow, that would be insane. Quote Link to comment Share on other sites More sharing options...
suttercain Posted October 17, 2007 Author Share Posted October 17, 2007 Hi Ken, It was a lame move on my end. I had an if statement included above that was not being met. This prevented the query from being executed. Once I removed that, the loop worked. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.