chelnov63 Posted April 25, 2007 Share Posted April 25, 2007 Hi guys, I know the following is wrong... if a record is found how do i echo out the corresponing name? Thanks in advance <?php require_once("dbDetails.php"); //THIS FILES CHECKS WHETHER THE USER CAN LOG IN OR NOT $email = $_POST["email"]; $password = $_POST["password"]; $currentdate = date("Y-m-d"); //mysqldetails $SQL = "SELECT * FROM members_tbl WHERE email ='".$email."' AND password = '".$password."'"; $rs = mysql_query($SQL,$conn); $numRows = mysql_num_rows($rs); if($numRows == 1){ echo $rs["name"]; }else{ echo "user not found"; } ?> Link to comment https://forums.phpfreaks.com/topic/48695-solved-newbie-problem-simple-login-check-script-how-do-i-echo-out-the-found-name/ Share on other sites More sharing options...
pocobueno1388 Posted April 25, 2007 Share Posted April 25, 2007 <?php require_once("dbDetails.php"); //THIS FILES CHECKS WHETHER THE USER CAN LOG IN OR NOT $email = $_POST["email"]; $password = $_POST["password"]; $currentdate = date("Y-m-d"); //mysqldetails $SQL = "SELECT * FROM members_tbl WHERE email ='".$email."' AND password = '".$password."'"; $rs = mysql_query($SQL,$conn); $numRows = mysql_num_rows($rs); $row = mysql_fetch_assoc($SQL); //Fetch the rows if($numRows == 1){ echo $row["name"]; }else{ echo "user not found"; } ?> Link to comment https://forums.phpfreaks.com/topic/48695-solved-newbie-problem-simple-login-check-script-how-do-i-echo-out-the-found-name/#findComment-238582 Share on other sites More sharing options...
chelnov63 Posted April 25, 2007 Author Share Posted April 25, 2007 Thanks for that poco ... appreciate it Link to comment https://forums.phpfreaks.com/topic/48695-solved-newbie-problem-simple-login-check-script-how-do-i-echo-out-the-found-name/#findComment-238585 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.