is it posible to create a SELECT query that give's back something like this?
array (size=2)
'table1' =>
array (size=2)
'column1' => int 1
'column2' => string 'username' (length=8)
'table2' =>
array (size=2)
'column1' => int 1
'column2' => string 'username' (length=8)
i need to select data with a join but one of the tables have about 100 columns and i would really like them to be grouped in one array key if it is possible.
thanks in advance!
Try this:
$a_rs = firstquery
$b_rs = secondquery
$ar = array();
$i=0
while($a_rs && $a_r = mysql_fetch_object($a_rs))
{
foreach($a_r as $k => $v)
{
$ar['a'][$i][$k] = $v;
}
$i++;
}
$ii = 0;
while($b_rs && $b_r = mysql_fetch_object($b_rs))
{
foreach($b_r as $k => $v)
{
$ar['b'][$ii][$k] = $v;
}
$ii++;
}
echo "<pre>".var_export($ar)."</pre>";