Jump to content

user log in


Alfraganus
 Share

Recommended Posts

I was trying to make log in using mysql too, however, something wring with my "mysql", I am not sure what I did wrong with it, could you please kindly check if there any possibility?

 

login.php:

 

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="Login1.php" method="POST">
Username:<input type="text" name="username"> <br>
Password:<input type="password" name="password"> <br>
<input type="submit" name="submit" value="log in">
</form>
</body>
</html>
login1.php
<?php
$username=$_POST ["username"];
$password=$_POST["password"];
if ($username&&$password) {
$connect=mysqli_connect("locahost", "root","") or die("can't connect!!");
mysql_select_db("phplog") or die("cant connect!!");
} else
die("please enter username and password");
?>
Link to comment
Share on other sites

Do you have a MySQL server set up and does it have a user "root" with no password? If you're on a web host you might need to findout their SQL server address, it's not always "localhost".

 

Simply connecting to the database won't do anything to log users in, though.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...