Hi,
Micah Stevens wrote:
> 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. Per
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 ad
> > $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 a
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 Maili
Hi,
it would have been easier to help you if you included some code snippet...
Use something like this:
$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];
}