hi....
i want a small help...
am new to php coding...
i have been desiging a project for my college..
i made a login and registration app... bt i am unable to mix the user and admin code..
can i hav any help..
user table consists of username,email,password
and admin the same things...
please...
and thanks in advance..
the below code is for login of user..
for login of admin i created a new table and inserted he data..
how to create both of the using a same table a one php file..
please help....
What I have tried:
$email = $_POST["email"];
$pass = $_POST["password"];
require "inti.php";
$query = "select * from userinfo where email like '".$email."' and password like '".$pass."';";
$result = mysqli_query($con,$query);
if(mysqli_num_rows($result)>0)
{
$response = array();
$code = "login_true";
$row = mysqli_fetch_array($result);
$name = $row[0];
$message = "login sucess...".$name;
array_push($response,array("code"=>$code,"message"=>$message));
echo json_encode(array("server_response"=>$response));
}
else
{
$response = array();
$code = "login_false";
$message = "login failed.....try again..";
array_push($response,array("code"=>$code,"message"=>$message));
echo json_encode(array("server_response"=>$response));
}
mysqli_close($con);
?>