Page 1 of 1

3 items in table, mysql_fetch_array shows only 1

Posted: Fri Jun 03, 2011 10:38 am
by $var
here is a BASIC php mysql query running in a function:

Code: Select all

		$select = mysql_query("SELECT price, quantity FROM cart_items WHERE (cid = '1')");	
		$row = mysql_fetch_array($select) or die (mysql_error());				
		var_dump($row);
Here is the table, the first field is the cid:

Code: Select all

	1 	59530N34022 	94 	2
	1 	15123N21999 	83 	2
	1 	13723N48311 	110 	2
My var_dump shows only the values of the 1st row.

The other 2 rows that follow the same condition are not appearing in the array.
Any clue as to why this limitation would be happening?

It's oh so frustrating.

Re: 3 items in table, mysql_fetch_array shows only 1

Posted: Fri Jun 03, 2011 12:33 pm
by AbraCadaver
Read the manual. mysql_fetch_array() fetches 1 row.

Code: Select all

while($row = mysql_fetch_array($select)) {
   var_dump($row);
}