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

From: Date: Mon, 23 Sep 2002 20:13:28 +0000
Subject: Re: AW: [PHP-DB] getting mysql_fetch_row into array
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-21947@lists.php.net to get a copy of this message
> > $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? No. The way it's written is it's adding an element onto the array with each loop. It's basically the same as doing array_push($deptcount,$row[0]); ---John Holmes...

« previous php.db (#21947) next »