NME Posted May 21, 2006 Share Posted May 21, 2006 This is my code:[code]$query= "SELECT userid, first_name FROM users2 WHERE username='$username' AND password='$password'";$result = @mysql_query($query);$row = mysql_fetch_array($result, MYSQL_NUM); //returns the row with that users information in the users2 table.if($row) { $_SESSION['userid']=$row[0]; $_SESSION['first_name']=$row[1]; $_SESSION['last_name']=$row[2];[/code]for some reason $row[2] returns nothing (meaning $_SESSION['last_name'] is nothing as well), although $row[1] and $row[0] return the values they intend from my SQL table. why won't row[3] or any subsequent rows show?thanks. Quote Link to comment https://forums.phpfreaks.com/topic/10089-session-problem/ Share on other sites More sharing options...
AndyB Posted May 21, 2006 Share Posted May 21, 2006 You only selected [b]two[/b] items from the table - those will be the zeroth and first elements of the $row array. Quote Link to comment https://forums.phpfreaks.com/topic/10089-session-problem/#findComment-37521 Share on other sites More sharing options...
NME Posted May 21, 2006 Author Share Posted May 21, 2006 ah ofcourse, im an idiot. thanks so much. should've been SELECT * FROM ... Quote Link to comment https://forums.phpfreaks.com/topic/10089-session-problem/#findComment-37522 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.