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
Share on other sites

I have tried this and I get:

 

[06-Jun-2013 15:39:58] PHP Parse error:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /Applications/MAMP/htdocs/mrmen/index.php on line 11
 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.