javascript - in php i m creating registration and login but its not dynamic -
<?php session_start(); if (isset($_post["btnsubmit"])) { $nm=$_post["username"]; $pwd=$_post["password"]; $conn = new mysqli("localhost", "root", "", "simple_login"); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select * member username='$nm' , password='$pwd'" ; $result = $conn->query($sql); if ($result->num_rows > 0) { // add sesssion value $_session["memid"]=$row["mem_id"]; $_session["username"]=$row["username"]; header("location:demo2.php"); } } else { echo "wrong username or password" ; } ?>
in facing designing database problems , facing problems in storing session variables well
<?php session_start(); if (isset($_post["btnsubmit"])) { $nm=$_post["username"]; $pwd=$_post["password"]; $conn = new mysqli("localhost", "root", "", "simple_login"); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select * member username='$nm' , password='$pwd'" ; $result = $conn->query($sql); while($row = $result->fetch_array()) { $row["mem_id"]; $row["username"]; } if ($result->num_rows > 0) { // add sesssion value $_session["memid"]=$_post["username"]; $_session["username"]=$_post["password"]; header("location:demo2.php"); } } else { echo "wrong username or password" ; } ?>
Comments
Post a Comment