jwwceo Posted December 13, 2007 Share Posted December 13, 2007 I have a query which shows all the rows for certain conditions. I am using while($info = mysql_fetch_array( $data )) for my loop to output each row. I would like there to be a message saying "Nothing to edit" if the rows are empty. I tried this: if (empty ($info)){ echo "<p><h2>There are no packages to edit</h2></p>"; } But I get this message no matter what. I am thinking that $info has no value after the loop. What other variable can I use??? James Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 13, 2007 Share Posted December 13, 2007 You need to check the results. <?php if (mysql_num_rows($data)==0){ echo "<p><h2>There are no packages to edit</h2></p>"; } else ( while($info = mysql_fetch_array( $data )) //Do something } } ?> Quote Link to comment Share on other sites More sharing options...
jwwceo Posted December 13, 2007 Author Share Posted December 13, 2007 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.