i have problem in my code. First of all works fine with mysqli connection, but then i try do just mysql (becouse my another function only working with mysql not mysqli).Something in my login fucktion dont working, nick and pass are right. In database table name user. Please help me my code
require_once('connection.php');
session_start();
if(isset($_POST['Login']))
{
if(empty($_POST['UName']) || empty($_POST['Password']))
{
header("location:index.php?Empty= Please Fill in the Blanks");
}
else
{
$name = trim($_POST['UName']);
$pass = trim($_POST['Password']);
$query="select * from user where nick='".$name."' and pass='".$pass."'";
$result= mysql_query($con,$query);
$result2 = mysql_fetch_assoc($result);
if($result2['nick'])
{
$_SESSION['User']=$name;
header("location:wellcome.php");
}
else
{
header("location:index.php?Invalid= Please Enter Correct User Name and Password ".$name." ".$pass." ");
}
}
}
So i always get Please enter correct user name. connection.php
$con=@mysql_connect('localhost','sesseses','DjWJfD4q');
mysql_select_db('sesseses');
if(!$con)
{
die(' Please Check Your Connection'.mysqli_error($con));
}
Any idea? i cant found solution on my own..
Aucun commentaire:
Enregistrer un commentaire