quote: "We need a control panel for the world"
BastardDomain Forums \ Development \ is dit een nuttige functie?
is dit een nuttige functie?
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
31 Oct 2004

<?php
function transfer_result_to_array($queryresult){
//put values in array
while ($a=mysql_fetch_assoc($queryresult)){
$values[]=array_values($a);
}
//put keys into array
mysql_data_seek($queryresult,0);
$a=mysql_fetch_assoc($queryresult);
$keys=array_keys($a);

//build combined array
$i=0;
foreach ($values as $nothing=>$multi){
foreach ($multi as $valuenr=>$value){
foreach ($keys as $keynr=>$label) {
if ($keynr==$valuenr)
$resultvalue[$label]=$value;
$result[$i]=$resultvalue;
}
}
$i++;
}
return $result;
}

q="SELECT * FROM table";
if (!$rAll=mysql_query($q)){
echo 'fout';
die;
}else{
$rArray=transfer_result_to_array($rAll);
}
?>
Fox
The Guzzler

avatar Fox

Registered: 10 Apr 2001
Location: North-Brabant
Posts: 9399
31 Oct 2004

Ik weet niet wat je precies probeert te doen, maar efficient gaat het allerminst.

Refuse to do what you don't want to do.
[user image]
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
31 Oct 2004

probleem staat beschreven hier:
http://www.phpfreakz.nl/forum.php?forum=1&iid=499271#id499445
en hier
http://www.phpfreakz.nl/forum.php?forum=1&iid=498558#reply
Fox
The Guzzler

avatar Fox

Registered: 10 Apr 2001
Location: North-Brabant
Posts: 9399
31 Oct 2004

waarom gebruik je niet meteen mysql_fetch_array()?

Refuse to do what you don't want to do.
[user image]
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
31 Oct 2004

Returns an array that corresponds to the fetched row

omdat dat hetzelfde probleem geeft
Fox
The Guzzler

avatar Fox

Registered: 10 Apr 2001
Location: North-Brabant
Posts: 9399
31 Oct 2004

Dan zal ik jou probleem wel niet helemaal begrijpen.

Ik heb het probleem ook nooit gehad.

Refuse to do what you don't want to do.
[user image]
 1 
© 2000 - 2020 BastardDomain.com