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:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 4:17 AM
To: [EMAIL PROTECTED]
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



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

Reply via email to