MySQL Forums
Forum List  »  Perl

Why This Code is Not working
Posted by: Binu Mathew
Date: March 05, 2009 08:05AM

<?php
$con = mysql_connect("localhost","root","erd");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("erd", $con);

if($_POST["Type"]='CA')
{
$type="College Admin";
}
if($_POST["Type"]='stud')
{
$type="Student";
}
$query="SELECT * FROM scmanager.user_login_details where userID= '".$_POST["userid"]."' AND password='".$_POST["psw"]."' and role='".$type."'";

$result=mysql_query($query) or die('error');
$numrows = mysql_num_rows($result);

if(!numrows)
{
if($_POST["Type"]='CA')
{
echo "<center>";
echo "<div class='main'>";
echo "<div class='box'>";
echo "Congrates! You got Loged In";
echo "<br><br>";
echo "<form action='ca/CAdminHome.php' method='post' name='myform'>";
echo "<input type='hidden' name='userID2' value='".$_POST["userid"]."'>";
echo "<input type='hidden' name='type2' value='".$_POST["Type"]."'>";
echo "<div class='spacer'><a href='#' onClick='document.myform.submit();' class='green'>Enter</a></div>";
echo "</form>";
echo "</div>";
echo "</div>";
echo "</div>";
echo"</center>";
echo "</body>";
}

elseif($_POST["Type"]='stud')
{

echo "<center>";
echo "<div class='main'>";
echo "<div class='box'>";
echo "Congrates! You got Loged In";
echo "<br><br>";
echo "<form action='Student/CAdminHome.php' method='post' name='myform1'>";
echo "<input type='hidden' name='userID2' value='".$_POST["userid"]."'>";
echo "<input type='hidden' name='type2' value='".$_POST["Type"]."'>";
echo "<div class='spacer'><a href='#' onClick='document.myform1.submit();' class='green'>Enter</a></div>";
echo "</form>";
echo "</div>";
echo "</div>";
echo "</div>";
echo"</center>";
echo "</body>";
}
else
{
Header("Location: http://127.0.0.1:8080/scmanager/relogin.php";);
exit;
}
}
mysql_close($con);
?>

I think there is an Error in the "if" code can u say what is that?

Options: ReplyQuote


Subject
Written By
Posted
Why This Code is Not working
March 05, 2009 08:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.