PDA

View Full Version : Selecting 10 rows from a table and setting them each to a seperate variable?


Link14716
02-01-2003, 03:15 PM
How exactly could I pull this off with just 1 query?

Graphics
02-01-2003, 03:38 PM
LOL. What a conisidence. I'm asking more or less the same in my thread... :(

Sebastian
02-01-2003, 08:50 PM
<?php

$result = @mysql_query("SELECT * FROM $table");
while ($row = mysql_fetch_row($result)) {

$var1 = $row[1];
$var2 = $row[2];
$var3 = $row[3];
$var4 = $row[4];
$var5 = $row[5];
$var6 = $row[6];
$var7 = $row[7];
$var8 = $row[8];
$var9 = $row[9];
$var10 = $row[10];

}

?>


etc...

Link14716
02-01-2003, 11:34 PM
Thanks :)

Sebastian
02-02-2003, 12:02 AM
np. Thought i'd give another possibility.


<?php

$result = @mysql_query("SELECT id, date, topic, users FROM $table");
while (list($id, $date, $topic, $users) = @mysql_fetch_row($result)) {

}

?>


etc..