Jump to content

If Else Problem


olilish
 Share

Recommended Posts

Hello, I have a problem with If Else.I would like a simple 'no new records' message to be displayed if no new records have been added.This is my code.-----------------------------------------------------$result = mysql_query("SELECT * FROM pages WHERE approved='0' ORDER BY id DESC");if ($result==NULL){echo "<p>No new Testimonials</p>";}else {while($row = mysql_fetch_array($result)) {*and this is where i echo my results* }}----------------------------------------------------So, when there are no new records or records WHERE approved = '0', I would just like a simple - No new records echo.I do not get any error message, but my echo does not show up.Any help would be superb!!THanks.

Link to comment
Share on other sites

mmm, this works but it doesn't really help.I need to be able to determine if there are any records that have a value of '0' in my approved field.If there are none, then echo no new testimonials.So how do I query for 'are there any 0's ' ??

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...