Getting values from table and storing it to variable.. PHP & MySQL
I have one table which contains user_id, username, password and points columns. It is in table named "users" in database named 'admin_users".
When one successfully login, the following is set...
PHP Code:
$username = $_SESSION['username'];
now, i want to store $points variable equal to points of user named "$username" , how to do it. Means (i think i wasn't clear what i wanted to say), i want to get value of column "points" from table users where username = $username....
$query = "SELECT * FROM table WHERE username = 'someuser'"; $exe = mysql_query($query); while($row = mysql_fetch_array($exe)){ foreach($row as $r => $v){ /* $r is the column name and $v is the value */ $_SESSION[$r] = $v; } }
Bookmarks