Jump to content

counting records


jarv

Recommended Posts

hi, I would like to display a number next to each of my books ie:

 

Book Title 1: Mr. Tickle
Book Title 2: Mr. Greedy
Book Title 3: Mr. Topsy-Turvy
Book Title 4: Little Miss Bossy
Book Title 5: Mr. Uppity

 

 

but instead (as they are being output as an array) I get:

 

Book Title 0: Mr. Tickle
Book Title 1: Mr. Greedy
Book Title 2: Mr. Topsy-Turvy
Book Title 3: Little Miss Bossy
Book Title 4: Mr. Uppity

 

 

here is my code

$pagecount=0;
$qry="SELECT BookID,BookTitle,BookInfo FROM mrmen";
$cur=mysql_query($qry);
if(!$cur){
    echo $cur.'<br />'.mysql_error();
}
while($i=mysql_fetch_row($cur))
{$BookID[$pagecount]=$i[0];
$BookTitle[$pagecount]=$i[1];
$BookInfo[$pagecount]=$i[2];
$pagecount++;
}


for ($i=0;$i<$pagecount;$i++){
    echo 'Book Title '.$i.': '.$BookTitle[$i].'<br />';
}      

Link to comment
https://forums.phpfreaks.com/topic/278845-counting-records/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.