Hello,

Can someone please help me to put the results of a query to an array. Never 
done this before:

$sql = "SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri 
ASC";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
$cur = 1;

//create empty array that contains an array before loop
$arr = array("Team" => array());

while ($num >= $cur) {
$row = mysql_fetch_array($result);
$id = $row["jouk_id"];
$srt = $row["sortteri"];
$nimi = $row["jouk_nimi"];

//append values to the array
$arr = array("Team$cur" => array(0 => $id, 1 => $srt, 2 => $nimi));

$cur++;
}

Thanks
-Will 

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

Reply via email to