fallenangel1983 Posted March 11, 2008 Share Posted March 11, 2008 I have tried some of the online tutorials that talk about user defined variables but i dont know what to do next. can anyone help? <?php // Connect to server and select databse. mysql_connect("localhost","root","") or die("cannot connect"); // username and password sent from sign up form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1) { while($row=mysql_fetch_row($result)) { $username = $row[0]; $password = $row[1]; $idType = $row[2]; if($idType==1) { session_start(); header("location:Users.html"); } elseif($idType==2) { session_start(); header("location:Admin.html"); } elseif($idType==3) { session_start(); header("location:Management.html"); } } } else { echo "Wrong Username or Password <br><a href='./LoginPage.php'>Go Back</a>"; } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted March 11, 2008 Share Posted March 11, 2008 Change this... $result=mysql_query($sql); to... $result=mysql_query($sql) or die(mysql_error() ."<br />" . $sql); What do you get? Quote Link to comment Share on other sites More sharing options...
fallenangel1983 Posted March 11, 2008 Author Share Posted March 11, 2008 brilliant thanks very much i have been struggling with that for hours. cheers again Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2008 Share Posted March 11, 2008 use session start once on top of page........ <?php session_start(); ?> dont need all theose session_start's mate.......... Quote Link to comment Share on other sites More sharing options...
fallenangel1983 Posted March 11, 2008 Author Share Posted March 11, 2008 oh i didnt know that. appreciated. cheers again. above and beyond the call of duty mate nice one Quote Link to comment 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.