Page 1 of 1

Getting info from MySQL Database

Posted: Wed May 31, 2006 4:49 pm
by punchthemonkey94
Hi, I'm trying to pull info from column "name" in my database. I use the following code to try and get it:

Code: Select all

$sql2="SELECT name FROM Users WHERE uname='$uname' and pass='$pass'";
	$result2=mysql_query($sql2);
When I try to run the query in phpMyAdmin, I get the correct info, but when I call $result2, it returns "Resource id #5" instead of the info from column "name" that I want. How do I get that info?

Posted: Wed May 31, 2006 4:52 pm
by jayshields
mysql_fetch_array()
mysql_fetch_row()

Have a look in the examples on there - remember, check the manual first, post on the forum second.

Posted: Wed May 31, 2006 4:59 pm
by punchthemonkey94
I already looked in the manual, specifically at mysql_fetch_array() and mysql_fetch_row() but I didn't realise how to use them, but I just figured it out. Thanks.