Jump to content

getting data from mysql


tecdesign

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
Link to comment
https://forums.phpfreaks.com/topic/8746-getting-data-from-mysql/
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]
Link to comment
https://forums.phpfreaks.com/topic/8746-getting-data-from-mysql/#findComment-32122
Share on other sites

Archived

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

×
×
  • Create New...

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.