Re: WHILE

From: Date: Sun, 19 Jul 2009 15:13:04 +0000
Subject: Re: WHILE
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-46338@lists.php.net to get a copy of this message
Why don't you use mysql_fetch_assoc() instead? You can address your fields directly, as in: while($row_FOTOS=mysql_fetch_assoc($result)) {
        echo "<img src='products/".$row ["picture1"]."' border='0' height='384' />";
        echo "<img src='products/".$row ["picture2"]."' border='0' height='384' />";
} Alternatively, you can specify which fields you want in your SQL statement: $sql = "SELECT picture1, picture2 FROM picture WHERE id = '$ID'"; $result =mysql_query($sql,$conn); while($row_FOTOS=mysql_fetch_array($result)) {
        echo "<img src='products/$row [0]' border='0' height='384' />"; // picture1
        echo "<img src='products/$row [1]' border='0' height='384' />"; // picture2
}

« previous php.db (#46338) next »