I change one line in the login code but still not working...
anyone have the answer for my problem
thanks
<?php
if (isset($_POST["enter"])) {
//set up names of database and table to use
$db_name = "projectov5";
$table_name = "users";
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="....."; // Mysql password
$name =$_POST['name'];
$pass = $_POST['password'];
//connect to server and select database
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//build and issue the query
$sql = "SELECT name, password FROM users WHERE name = '$name' AND password = '$pass'";
$result=mysql_query($sql);
//print a message or redirect elsewhere, based on result
if (mysql_fetch_array($result)){
header( 'Location: Principal.php');
} else {
echo "<p style='color:green;'>User not in the database.</p>";
}
mysql_close();
}
?>