<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$db = mysql_connect("localhost", "*******" , "*****")or die("Error connecting to database: " . mysql_error());
$db_used = mysql_select_db("pskkorg_drp1", $db)or die("Could not select database: " . mysql_error());
$user_name = mysql_real_escape_string($_POST['username'],$db);
$query = mysql_query("SELECT * FROM student WHERE Username = '$user_name'",$db) or die(mysql_error());
if(mysql_num_rows($query) == 1){
echo "Login successful, welcome back " . $user_name . "";
}else{
echo "Login unsuccessful, please ensure you are using the correct details";
}
}else{
echo "Error";
}
?>
take a look at this code, is there anything wrong?... it always come out the error output when i test it.
when i enter this url,
http://www.pskk.org/LMS/LMSscripts/FirstTimeUser10.php?Username=149090
it come out Error. suppose it will appear Login Successful since the username 149090 exist in the database.