<?php
$query = "SELECT * FROM register_user where user_id= '$id' AND password='$pwd'";
$result = mysql_query($query);
$query_data = mysql_fetch_row($result);
IF (!$query_data[0]) {
echo("<center><p> </p><p> </p><p> </p><p> </p><p> </p>");
$error = "You have submited an incorrect login and password combination. Please try again!";
echo($error);
echo(" <a href="index.php">login user</a></center>");
}
ELSE{
echo($query);
$user= $query_data["user_type"];
$user_id= $query_data["user_id"];
echo("$user_id");
if ($user == "Data Entry")
{
echo("<br>U are ");
echo("$user!");
}
else
{
echo("<br>U are ");
echo("suppose to be not data entry!");
echo("U are ");
echo("$user!");
?>
Actually, there are many users will use my system, then when i select it by using their id and password, then system will know the type of user who currently try to access my system. I try to do my best, but not working. Can anyone help me?
<?php
$result = @mysql_query("SELECT * FROM register_user where user_id= '$id' AND password='$pwd'");
$numrow = mysq_num_rows($result);
if ($numrows > 0){
// succesful login
if ($user == "Data Entry")
{
echo "<br>You are ".$user."!";
}
else
{
echo "<br>You are not Data Entry, you are ".$user;
}
}else{
// unsuccesful login
echo "You have submited an incorrect login and password combination. Please try again!";
echo "<center><a href='index.php'>login user</a></center>";
}
?>
$result = @mysql_query("SELECT * FROM register_user where user_id= '$id' AND password='$pwd'");
$numrow = mysq_num_rows($result);
SHOULD BE:
$result = @mysql_query("SELECT * FROM register_user where user_id= '$id' AND password='$pwd'") or die("Query Error!");
$numrow = mysq_num_rows($result);
always best to check errors in the scripts and querys, lol
Silly me, how did I miss that... you should always have an escape to report your errors.. sometimes they don't all get shown ( unless you got error_reporting(E_ALL) on.
That is not my currently actual problem, my problem is how to get data from ($user) and how to check it either it is Data Entry or not? How to get it($user) from the sql query? Pls help me..!!!
K here is what I got from that: I still don't know what user is. Is it the users name? or is it they level level? what? I ask this because I have no idea what $dataentry is supposed to mean. And thirdly I'm assuming you are pulling dataentry from the database.