Hello, I just joined up with this forum and am complete php noob _
Anyways I was wondering how to retreive a whole bunch of data from a table (users) from my mysql database.
I have a a crap load of fields in this table and would like to be able to call upon this information using something like a $_SESSION['username'] thing goin on.
My purpose is for my "members" script, which registers users and what not but once my users are in the clear ( the successful_login.php page) I would like to display things such as how much money the user has ( btw this is a simple php game ) and his username and other information.
What I can't seem to figure out is how to display the information and be able to edit it.
Soming like the following would be used to display it for the current user?
$sql = mysql_query("SELECT cash FROM users WHERE username=$_SESSION['username']")
Or maybe could I set my $SESSION's like this so I can call them when I need to? 😕
$_SESSION['username'] = mysql_query(...)
$_SESSION['cash'] = mysql_query(...)
$_SESSION['heat'] = mysql_query(...)
Also I am running php 4.3.8 on a *nix system, also this is what my table looks like...
CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
first_name varchar(25) NOT NULL default '',
last_name varchar(25) NOT NULL default '',
email_address varchar(25) NOT NULL default '',
username varchar(25) NOT NULL default '',
PASSWORD varchar(255) NOT NULL default '',
info text NOT NULL,
user_level enum('0','1','2','3') NOT NULL default '0',
signup_date datetime NOT NULL default '0000-00-00 00:00:00',
last_login datetime NOT NULL default '0000-00-00 00:00:00',
activated enum('0','1') NOT NULL default '0',
cash int(255) NOT NULL default '0',
heat int(255) NOT NULL default '0',
experience int(255) NOT NULL default '0',
level int(25) NOT NULL default '0',
PRIMARY KEY (userid)
) TYPE=MyISAM COMMENT='Membership Information' AUTO_INCREMENT=12 ;
Sorry I am horrible at mysql querys :p, but any help for retreiving the information and using querys or some other way to edit/display it would be a great help,
Thanks 🙂