almightyegg Posted April 5, 2007 Share Posted April 5, 2007 How can I make it auto number something in a while loop like: while($jnfw){ echo "[AUTO NUMBER]. $jnfw[blah]"; } That would show: 1. SOme value 2. Some value 3. Some value etc... I know I'm asking for a lot of help today but I'm trying to push my project forward Any help is greatly received and thanks in advance Quote Link to comment Share on other sites More sharing options...
papaface Posted April 5, 2007 Share Posted April 5, 2007 would: while($jnfw){ echo rand() . $jnfw[blah]; } work? Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 5, 2007 Author Share Posted April 5, 2007 nope, no joy Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 5, 2007 Share Posted April 5, 2007 would: while($jnfw){ echo rand() . $jnfw[blah]; } work? Would put a random number before each entry...I think he wants a sequential number... $i = 0; while($jnfw){ echo ++$i . $jnfw[blah]; } Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 5, 2007 Author Share Posted April 5, 2007 $i = 0; while($jnfw){ echo ++$i . $jnfw[blah]; } echo "<td>++$i . $clutch[name]</td><td>$clutch[id]</td>"; all that does is: ++0 . Group Name ++0 . Group Name2 etc... ??? and I did put the $i = 0; in and before the while starts. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 5, 2007 Share Posted April 5, 2007 I don't think php will parse the increment operator when it's inside of quotes... echo "<td>" . $i++ . " " . $clutch[name] . "</td><td>" . $clutch[id] . "</td>"; Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 5, 2007 Author Share Posted April 5, 2007 Ohh! It works! Although it starts at 0...do I just change $i = 1; to make it start from one? Quote Link to comment Share on other sites More sharing options...
papaface Posted April 5, 2007 Share Posted April 5, 2007 yes Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 5, 2007 Author Share Posted April 5, 2007 Cheers all done with that thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.