View Single Post
  #1 (permalink)  
Old 12-17-03, 03:41 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Number Display Help

Hi again,

I need a code to display numbers in a row, each time the same echo code is displayed. For example, the first time it is displayed i'd want it to display 1, then the second it would display 2, and so on. I'm trying to do something like the following code at the moment, but the problem is a can't get it to display anything other than 1 each time the echo code is posted

PHP Code:

<?php

while ( $num <= ) {
    
$num += 1;
}
?>

<?php echo $num?>
Perhaps if someone could show me a correct code? Also, the echo code has to be the same each time, so things the following code won't work, because i will be deleting certain parts of the code at certain times, and i will need it to, say, if i delete part number two, for it to display '2' on number three, if you follow what i mean...

PHP Code:

<?

$numbers
=array("1","2","3");
sort($numbers);
?>

<?php echo $numbers[0]; ?>

<?php echo $numbers[1]; ?>

<?php echo $numbers[2]; ?>
Thanks to everyone who helps, if you can understand this, and also thanks to blaw, i got my code working last time
Reply With Quote