Are you sure $n is being set somewhere?

Why not do it like this:

while($row = mysql_fetch_row($resultCurrName))
{
  print $row[0]+1;

  //do rest of whatever...
}

---John Holmes...

----- Original Message -----
From: "Davíð Örn Jóhannsson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 8:39 AM
Subject: [PHP] Problem with a for loop...


I have al for loop that looks something like this:

$checkCurrName  = "SELECT imgName FROM $db_img ORDER BY imgName DESC";
$resultCurrName = mysql_query($checkCurrName, $db);


for ($i = 0; $i < $n; $i++){
            list($currName) = mysql_fetch_row($resultCurrName);
            $newName = $currName++;
print($newName);

//insert $newName into db
}

The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i'm not getting the newest value from the database after the first
loop.

Any Ideas about this

Thanks, David


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to