I am working on a school assignment in which the user needs to register on mysql before they can enter the site. With this code it keeps telling me that the name and password are not registered in the database, when they are. It keeps looping in the if statement and never makes it to the else part.
Thanks in advance
[php]<?php
session_start();
mysql_connect(“localhost”,“root”,"") or die(mysql_error());
mysql_select_db(“data”) or die(mysql_error());
$fname = $_POST[“fname”];
$password = $_POST[“password”];
//$image = $_POST[“imagename”];
$sql = “SELECT * FROM users where name=’”.$fname."’ and password=’".$password."’";
//echo $sql;
$result = mysql_query($sql);
//echo $result;
if(!$result){
echo “it is not there”;
?>
<?php
}
else{
echo “your here”;
$_SESSION[‘name’]=$fname;
?>