The following example will show u how to do it with mysql_result which will retrive one row only.
From PHP Manual:
<?php $link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());
$result = mysql_query("SELECT name FROM work.employee") or die("Could not query: . mysql_error());
echo mysql_result($result,0); // outputs first employee's name
mysql_close($link); ?>
Regards, Hamid Hossain
----------------------- Check Amazon.com Latest PHP books: http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/browse/-/295223
Start Accepting CreditCard at your site in minutes: http://www.2checkout.com/cgi-bin/aff.2c?affid=106720
Download Alexa Tool Bar to stop Pop-ups for FREE: http://download.alexa.com/?amzn_id=zawraqclassif-20
Download Ready-Made Templates for your site: http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad
----Original Message Follows---- From: "Angelo Zanetti" <[EMAIL PROTECTED]> Reply-To: <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> Subject: [PHP] mysql functions Date: Tue, 10 Feb 2004 11:44:47 +0200
I have a query which returns only 1 row, which of the following would be the best to get the value from the resultset:
mysql_result() mysql_fetch_field() mysql_fetch_row()
the resultset only returns 1 column, so basically its only 1 field i get from the resultset.
thanx in advance. angelo
-------------------------------------------------------------------- Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php