Page 1 of 1

number

Posted: Wed Jul 28, 2004 12:19 am
by SidewinderX
Hello, i have a lyrics database and I want to make a script to display how many lyric records I have. I origionally thought to just dispaly the $id and add one to it since the record starts at 0. But first i just tried just to dispaly $id

Code: Select all

<?php
echo ("We got in our database $id lyrics");
?>
and that yielded 12, although I have more then 12 entries. What am i doing wrong?

Posted: Wed Jul 28, 2004 12:32 am
by kettle_drum

Code: Select all

SELECT count(*) FROM lyrics_table;

Posted: Wed Jul 28, 2004 9:41 am
by Grim...
Or you could use the PHP command [php_man]mysql_num_rows[/php_man]($query);

Posted: Wed Jul 28, 2004 10:37 am
by ol4pr0
IE:

Code: Select all

$result = mysql_query("SELECT * FROM --TABLE--");
$num_rows = mysql_num_rows($result);
echo $num_rows;