Mysql query (select a, b, c) into a Php multidim Array

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
liderbug
Forum Newbie
Posts: 19
Joined: Tue Jul 23, 2002 2:18 pm

Mysql query (select a, b, c) into a Php multidim Array

Post by liderbug »

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
liderbug
Forum Newbie
Posts: 19
Joined: Tue Jul 23, 2002 2:18 pm

Post by liderbug »

:oops: never mind .......... well, as long as your here ...any suggestions on improvment - other than the obv. :oops:

Chuck
Post Reply