Dysan Posted February 27, 2008 Share Posted February 27, 2008 Hi, Whats the best way to count the total about of records contained inside a table? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 27, 2008 Share Posted February 27, 2008 <?php $q = "Select count(*) as table_count from `table`"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q; $table_rows = mysql_result($r,0); Quote Link to comment Share on other sites More sharing options...
Dysan Posted February 27, 2008 Author Share Posted February 27, 2008 What does the zero do in this code? mysql_result(mysql_query("SELECT COUNT(*) FROM music"), [b]0[/b]); Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 27, 2008 Share Posted February 27, 2008 returns the 0th row of the query i.e the only row and since its one item your good to go 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.