Re: AW: [PHP-DB] getting mysql_fetch_row into array

From: Date: Mon, 23 Sep 2002 20:09:41 +0000
Subject: Re: AW: [PHP-DB] getting mysql_fetch_row into array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-21948@lists.php.net to get a copy of this message
Nope. Anytime you set an array with no index equal to something, (i.e. $deptcount[]) it will add another element to the end of the array. If you use .=, that means append the data, but since you're not specifying an element, I'm not sure what it would do. Perhaps PHP is smart enough to just add another element anyway. Have you tried this? -Micah At 10:01 PM 9/23/2002 +0200, Johannes Janson wrote:
Hi,
$res = mysql_query ("SELECT COUNT(deptid) FROM maintenance GROUP BY deptid"); $deptcount = array(); // reset the array while ($row = mysql_fetch_row ($res)) { $deptcount[] = $row[0];
this should be $deptcount[] .= $row[0]; shouldn't it?
}
cheers J -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#21948) next »