[thelist] php query problem

Andy Warwick mailing.lists at creed.co.uk
Tue Oct 15 17:29:01 CDT 2002


On Tuesday, October 15, 2002, at 10:56 PM, Dunstan Orchard wrote:

> can anyone tell me why this code reults in _two_ copies of each image
> being
> inserted into table 'cart'?
>
> while ($row = mysql_fetch_array($result))

mysql_fetch_array retrieves an array with both associative and number
indices for each entry.

add the line:

	print_r ( $row ) ;

to see what it's doing.

This is more fully explained in the manual at:

	<http://www.php.net/mysql_fetch_array>

Try using mysql_fetch_assoc($result) instead.

HTH

--
Andy Warwick
Creed New Media Design, Nottingham, UK
<http://www.creed.co.uk/src/evo/index.htm>




More information about the thelist mailing list