xxreenaxx1 Posted February 4, 2011 Share Posted February 4, 2011 I have a database which contains three users. But I can only access one of the user through PHP. When I try to enter other username I get a blank message. Anyone knows why?? Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 4, 2011 Share Posted February 4, 2011 You have an error in your code, somewhere around line 42. Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169766 Share on other sites More sharing options...
xxreenaxx1 Posted February 4, 2011 Author Share Posted February 4, 2011 How do you know its line 42. Well I got that fixed. Now I got another problem which I want to make a query ("SELECT * FROM user WHERE Rol_ID =1") But this wont work. Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169774 Share on other sites More sharing options...
BlueSkyIS Posted February 4, 2011 Share Posted February 4, 2011 the line before that one is the problem. seriously: we need to see the code. otherwise, we're just guessing. Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169839 Share on other sites More sharing options...
xxreenaxx1 Posted February 4, 2011 Author Share Posted February 4, 2011 My problem has been moved on from that to getting a blank page. PHP is just killing my life <?PHP $connect = mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("Examination") or die(mysql_error()); if ($_POST['submit']) { //get data $username= $_POST['user']; $password =$_POST['pass']; if ($username && $password) { $query = mysql_query("SELECT * FROM user"); while($getrows =mysql_fetch_assoc($query)) { $dbuser = $getrows['user']; $dbpass = $getrows['pass']; } if (($username == $dbuser) &&($password == $dbpass)) { echo "welcome" . $_COOKIE['username'] . "whoever"; $_SESSION['username'] = $username; } else { echo"failed"; } } else { die("Field not empty"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169843 Share on other sites More sharing options...
BlueSkyIS Posted February 4, 2011 Share Posted February 4, 2011 is this ever true?? if ($_POST['submit']) { a better way to check to see if the form was posted is to use if ($_SERVER['REQUEST_METHOD'] == "POST") { Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169849 Share on other sites More sharing options...
xxreenaxx1 Posted February 4, 2011 Author Share Posted February 4, 2011 Atleast I am getting an error message. But is says the login is failed. Even though the data does Exist. Quote Link to comment https://forums.phpfreaks.com/topic/226659-why-cant-i-have-more-then-one-user/#findComment-1169850 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.