mysql: How to see how many elements a result has
By liviu - Posted on May 6th, 2009
Tagged:
To see how many elements a mysql result has in php you use mysql_num_rows like so:
$query="select * from news where a=1 order by id desc";$result=mysql_query($query);if (mysql_num_rows ($result) == 0){ echo 'no news has been added yet'
}
else { while($row=mysql_fetch_array($result)) {
......
}}
Bookmark/Search this post with:
- liviu's blog
- Login or register to post comments
Delicious
Digg
StumbleUpon
Propeller
Reddit
Magnoliacom
Newsvine
Furl
Facebook
Google
Yahoo
Technorati
Icerocket