RE: [PHP-DB] A newbie in deep need for help
| From: | Rich Hutchins | Date: | Fri, 27 Dec 2002 17:45:36 +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-24421@lists.php.net to get a copy of this message | ||
Yes, first you use:
$result = mysql_result($query2);
That will return something like resourceID #3. That's right. What you need
to do now is to use a function to access the resource. For example, if you
have a table named User with the following columns:
ID
username
passwd
and you want to perform a query that just returns the password, your code
would look like something like this:
$query2 = "select passwd from user where username = '$username'";//query
$result = mysql_query($query2);//perform the query and return result set
$thisPass = mysql_result($result);//return one column (passwd) from result
set
echo"<p>".$thisPass."</p>"; //this line would just echo out the
variable
$thisPass to the browser to show you what it contains.
Try that code and see if it works for you. If not, respond and paste all of
the code you're working with and I'll see if I can find what's going wrong.
Rich
-----Original Message-----
From: Ehab El Maraghy [mailto:e_elmaraghy@yahoo.com]
Sent: Friday, December 27, 2002 12:24 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] A newbie in deep need for help
Rich
thanx for answering
I did what you said yesterday before using mysql_resut it returns resource
id#3 didn't know what is it and how can i transform it it the data inside
the cell
i corrected the situation and i waited to give me res.id#3 but it doesn't
write anything any suggestions ? from my part i will revise the code
once again
waiting for your reply thanx
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php