Hi
I have made a registration form with email confirmation to activate the account and the registration form and email activation link all works ok but am having trouble with the login script which thought would be the easy part, the error I keep getting is after I click submit to login, it says false and can’t work out why, my coding for it is below
[code=php]
<div id=”column-left”>
<form action=”login.php” method=”post” >
<label for=”user_name”>Username:</label>
<input name=”user_name” type=”text” id=”user_name” size=”60″/>
<br><br>
<label for=”pass_word”>Password:</label>
<input name=”pass_word” type=”password” id=”pass_word” size=”30″/>
<br><br>
<input name=”submit” type=”submit” value=”Submit”/>
</form>
</div>
<div class=”clear”></div>
<?php
session_start(); // Starting Session
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$db = mysqli_connect(“” , “”, “”) or die(“Check connection parameters!”);
// Optionally skip select_db and use: mysqli_connect(host,user,pass,dbname)
mysqli_select_db($db,””) or die(mysqli_error($db));
if (mysqli_connect_error()) {
die (‘Failed to connect to MySQL’);
} else {
/*SUCCESS MSG*/
echo ”;
}
if(isset($_POST[‘submit’]))
{
$user_name = trim($_POST[‘user_name’]);
$pass_word = trim($_POST[‘pass_word’]);
$query = “SELECT user_name, pass_word FROM visitors WHERE user_name=’$user_name’ AND pass_word=’$pass_word’ AND com_code IS NULL”;
$result = mysqli_query($db,$query)or die(mysqli_error($db));
$num_row = mysqli_num_rows($result);
$row=mysqli_fetch_array($result);
if( $num_row ==1 )
{
$_SESSION[‘user_name’]=$row[‘user_name’];
header(“Location: profile.php”);
exit;
}
else
{
echo ‘false’;
}
}
?>
Been trying for hours adjusting coding etc. but still keep getting false