Jump to content


Photo

getting data from mysql


  • Please log in to reply
1 reply to this topic

#1 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 30 April 2006 - 07:29 AM

Is there anyway of getting data from a mysql statement and storing it as a variable besides using sessions. I have found that some of my sessions are not registering. I only need the data for that particular page. For example
$sql = mysql_query (select * from table where user = $username);
$something = mysql_????;

I hope this explains what I am trying to do.

Cheers

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 April 2006 - 07:35 AM

The function you are looking for is mysql_fetch_array:
$sql = mysql_query (select * from table where user = $username);
$row = mysql_fetch_array($sql);


//then whenm you want to show the results do this:
echo $row['user'];
echo $row['pass'];
//other row names here





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users