2D arrays
| From: | Thomas Holton | Date: | Fri, 08 Dec 2000 18:15:35 +0000 |
| Subject: | 2D arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29384@lists.php.net to get a copy of this message | ||
Hello,
I cannot get any data into my 2D array. The documentation suggests
declaring 2d arrays in this fashion"
<snip>
$dat = array();
$dat = array_push($dat, array());
$ff = array();
while ($j < $numfields) {
$ff[$j] = mysql_field_name($r,$j);
print "ff=$ff[$j]<br>";
$j++;
}
$i=0; $j=0;
while ($i < $numresults) {
while ($j < $numfields) {
$dat[$j][$i] = mysql_result($r,$i,$ff[$j]);
print "dat=$dat[$j][$i]<br>";
$j++;
}
$i++;
}
reset($dat); // resets the pointer to be at the beginning
$numfields and $numresults contain real numbers, AND the $ff 1D array is
also fine.
This is the error message:
Warning: Cannot use a scalar value as an array in main_user.php on line 101
dat=[0]
Any help is appreciated!
thanks
-tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net