Mysql query (select a, b, c) into a Php multidim Array
Posted: Sun Nov 24, 2002 11:03 am
I need to do a mysql query [ select a, b, c, d from t1 where....]
and create a PHP array (multidim)
I've tried both
$data = array ( array ($ts, $tc, $ib, $ob) );
or
$data = array ($ts, $tc, $ib, $ob ); and array (); .....
This seems to fill the array ...
while ( $result = mysql_fetch_row ($resource) ) {
$data[$i][$ts] = $result[0];
$data[$i][$tc] = $result[1];
$data[$i][$ib] = $result[2];
$data[$i][$ob] = $result[3];
echo " $data[$i][$tc]\n";
$x = sizeof ($data);
echo "there are $x rows\n\n"; ... 1, 2, 3, .... 1576, 1577...
I've also tried $data[] = array_push ($data, explode(by comma..
and that seems to work.
But when I try to retrieve the data I get "Array[]"
Or is the answer "You can't get there from here :-/ "
Tks
and create a PHP array (multidim)
I've tried both
$data = array ( array ($ts, $tc, $ib, $ob) );
or
$data = array ($ts, $tc, $ib, $ob ); and array (); .....
This seems to fill the array ...
while ( $result = mysql_fetch_row ($resource) ) {
$data[$i][$ts] = $result[0];
$data[$i][$tc] = $result[1];
$data[$i][$ib] = $result[2];
$data[$i][$ob] = $result[3];
echo " $data[$i][$tc]\n";
$x = sizeof ($data);
echo "there are $x rows\n\n"; ... 1, 2, 3, .... 1576, 1577...
I've also tried $data[] = array_push ($data, explode(by comma..
and that seems to work.
But when I try to retrieve the data I get "Array[]"
Or is the answer "You can't get there from here :-/ "
Tks