[thelist] Dumb, just got dumber: PHP/MySQL Question

Rich Gray rich at f1central.net
Fri Mar 28 04:46:32 CST 2003


> Hello guys and gals, another dumb question from yours truly, in 
> PHP & MySQL
> I want to display how many records there are in a table, say I was
> displaying 6 results from a table that had 40 in total, any 
> ideas, since my
> little accident things have gotten harder to work out.
> 
> Thanks to all who sent me get well cards ;) you know who you are, 
> and if you
> didn't get to hear about it, mail me off board and I'll tell you.
> 

not quite sure what you're after but how about...

$rs = mysql_query('select count(*) as count from mytable');
if ($rs) {
   $row = mysql_fetch_assoc($rs);
   echo $row['count'];
}
else {
	// Probs..
}

HTH
Rich


More information about the thelist mailing list