Hi,
I am newbie, and I've got this lyrics database [MySQL table]
Now I list all songs written by a particular author on page. What I want to do is have a way of counting the total number of songs written by the author.
I'd like to display it as follows:
Songs written by XYZ: [number of songs]
Song 1
song 2
song 3
Here's my script
<p>Songs written by xyz</p>
<?
$result = mysql_query("SELECT * FROM songs where author like '%xyz%' ORDER BY lyr ASC",$db) or
die("Error in query");
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
echo "<table wdith=\"100%\">";
echo "<tr><td><p class=\"highlight\">Album</p></td><td><p class=\"highlight\">Song</p></td></tr>";
do {
printf("<tr><td><p><em>%s</em></p></td> <td><p><a href=\"?song=%s\" title=\"%s\">%s</a></p></td></tr>\n", $myrow["album"], $myrow["lyr"], $myrow["track"], $myrow["track"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>";
} else {
// no records to display
echo "Sorry, no songs were found!";
}
?>
So my question is how do I count the number of songs returned? and how do i display it above the table?