Re: baffled :<:<

From: Date: Tue, 17 Apr 2001 06:47:06 +0000
Subject: Re: baffled :<:<
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48904@lists.php.net to get a copy of this message
On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin (peterh@vfsa.com.au) wrote: >can any one see a problem with this loop? > > <? >$db = include"connect.inc"; >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > >$id = $myrow["id"]; >$card = $myrow["card"]; >$serial = $myrow["serial"]; >$avail = $myrow["avail"]; >$pn = $myrow["pn"]; >$cat = $myrow["cat"]; >$box = $myrow["box"]; >$quote = $myrow["quote"]; >} >?> > >if i call say just $card it only displays the one record (the last >one) if you call it after the loop you mean? thats what i would expect to be there. >the minute i try to call $myrow["card"]; i get nothing at >all... any idea's? outside the loop again? well if the last call to mysql_fetch_array() returns false, then that sounds right too. you probably mean to do something inside the loop. here's another tip, use extract: while ( ($myrow = mysql_fetch_array($result) ) ) { extract($myrow); echo $card."<br>\n"; } >I have script identical to this that works perfectly .. only >difference is this one has different names for the values > >Peter Houchin >peterh@sunrentals.com.au >========================================================= > _____ __ /\ > /_/_/_\ / |_/ \ > /_/_/_ __ __ __ __ / \ > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/ \_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/ v > ________ ________________________________________ > /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > /_/_ _/_/ ______ __ __ /_/ ____ __ ______ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\ /_/ /_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ >/_/ \_\/_/_/_/ /_/ \/_/ /_/ /_/ \_\/_/_/_//_/_/_/ >========================================================= >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 >************* We rent the dot in .COM! ************** >

« previous php.general (#48904) next »