Getting info from MySQL Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
punchthemonkey94
Forum Newbie
Posts: 6
Joined: Mon May 29, 2006 1:22 am

Getting info from MySQL Database

Post 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?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post 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.
punchthemonkey94
Forum Newbie
Posts: 6
Joined: Mon May 29, 2006 1:22 am

Post 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.
Post Reply