Re: Fetching into an array in MySQL

From: Date: Mon, 11 Dec 2000 21:28:56 +0000
Subject: Re: Fetching into an array in MySQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5166@lists.php.net to get a copy of this message
Try: while ($row = mysql_fetch_array($result)) { $userID[]=$row["userId"]; $lname[]=$row["Lname"]; $fname[]=$row["Fname"]; } Jon McFarling wrote: > I am trying to fetch the data gathered from a query into several arrays > I have tried the following but I lose the first row fetched: > while ($row = mysql_fetch_array($result)) > { > $userID[$userId++]=$row["userId"]; > $lname[$Lname++]=$row["Lname"]; > $fname[$Fname++]=$row["Fname"]; > } > to fix this I tried > while ($row = mysql_fetch_array($result)) > { > $userID[$userId]=$row["userId"]; > $lname[$Lname]=$row["Lname"]; > $fname[$Fname]=$row["Fname"]; > } > but no data was stored into the arrays > any ideas? > Jon > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#5166) next »