RE: [PHP-DB] A newbie in deep need for help
| From: | Rich Hutchins | Date: | Fri, 27 Dec 2002 16:33:10 +0000 |
| Subject: | RE: [PHP-DB] A newbie in deep need for help | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24413@lists.php.net to get a copy of this message | ||
Nope. Use this statement:
$result = mysql_query($query2);
The mysql_query() function actually performs the query to the db for you and
returns a "resource" with your result set contained within.
The mysql_result() function extracts the contents of a given cell from your
result set; it does not actually execute the query to the db. Essentially
you use mysql_result() to operate on a result set. Other things you can use
on your result set include, but are not limited to: mysql_fetch_array(),
mysql_fetch_row() and mysql_fetch_object, but again, they are operating on
the result set retrieved by the mysql_query() function.
Here's a good overview of the above functions:
http://www.php.net/manual/en/function.mysql-result.php
Hope this helps
-----Original Message-----
From: Ehab El Maraghy [mailto:e_elmaraghy@yahoo.com]
Sent: Friday, December 27, 2002 4:17 AM
To: php-db@lists.php.net
Subject: [PHP-DB] A newbie in deep need for help
Hi everybody
I have installed php4 and mysql on IIs winxp
I am trying to retrieve a password and print it using a query which is
written as followos
$query2 = "select passwd from user where username = '$username'";
$result = mysql_result($query2);
echo "<center><B>Old Password was $result </B></center>";
am I using mysql_result right or is there another function to print this
password taking in consideration that it just prints "Old Password was" and
that's it