Re: retrieve single field from database without while loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux