Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql using PHP ? PLEASE HELP 1

Status
Not open for further replies.

chuckbridges

Programmer
Apr 15, 2005
19
US
I have a table with the following

user
passwd
email
userlevel
nick
room
ip

$ID is = the current logged in users ID which is 24 when I test.

Yet when I run this from the web page

$sql = "SELECT * FROM phpSP_users";
$result=mysql_query($sql) or die("Blah");

I get Resource id #7 as my result?

Shouldnt I get the tables?

I am trying to take a users ID stored in $ID and match it to the user in the database then be able to use UPDATE to change one of those tables for the correct user?

Thanks Chuck Bridges
 
You get returned a handle to the results, you can use mysql_fetch_array($result) to get individual rows.
 
how about
Code:
$sql = "SELECT * FROM phpSP_users Where id=24";
$result=mysql_query($sql) or die("Blah");
$rows=mysql_fetch_array($result);

echo $rows['email'];
 
Thanks all I had to do is sub the id for userID like in the database and that works fine...

Cool....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top