Re: retrieve single field from database without while loop

From: Date: Wed, 16 Feb 2005 15:27:53 +0000
Subject: Re: retrieve single field from database without while loop
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-208829@lists.php.net to get a copy of this message
Hi, Wednesday, February 16, 2005, 9:48:41 PM, you wrote: rac> Is there a way to retrieve and display a single value (customer number) from rac> a database and display it without using rac> while ($row = mysql_fetch_array) ($result)){ rac> I have a value I know the query will only ever return a single value. I want rac> to get it from the database and convert it to a variable so I can use it on rac> my php page. rac> Thanks in advance, rac> Ross You can just drop the while $row = mysql_fetch_array($result); if you only have one row and one column you can do: $var = mysql_result($result,0,0); -- regards, Tom

« previous php.general (#208829) next »