Jump to content

Archived

This topic is now archived and is closed to further replies.

tecdesign

getting data from mysql

Recommended Posts

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

Share this post


Link to post
Share on other sites
The function you are looking for is mysql_fetch_array:
[code]$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
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.