shwetapandit Posted November 16, 2013 Share Posted November 16, 2013 the session var email is not saves as when ai am using if-else to check session isset it goes to else clause why it is so and how i can save my session. <?phpsession_start();$host="localhost"; // Host name$username="root"; // Mysql username$password=""; // Mysql password$db_name="regis"; // Database name$tbl_name="regis"; // Table name// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// username and password sent from form$email=$_POST['email'];$pass=$_POST['pass'];// To protect MySQL injection (more detail about MySQL injection)$email = stripslashes($email);$pass = stripslashes($pass);$email = mysql_real_escape_string($email);$pass = mysql_real_escape_string($pass);$sql="SELECT * FROM $tbl_name WHERE email='$email' and pass='$pass'";$result=mysql_query($sql);// Mysql_num_row is counting table row$count=mysql_num_rows($result);// If result matched $email and $pass, table row must be 1 rowif($count==1){$_session['email']="$email"; else { echo "Wrong Username or Password";} if(isset($_SESSION['email']))echo "amit"; elseecho "other";} ?> Link to comment https://forums.phpfreaks.com/topic/283957-session-var-is-not-stored/ Share on other sites More sharing options...
shwetapandit Posted November 16, 2013 Author Share Posted November 16, 2013 get solved Link to comment https://forums.phpfreaks.com/topic/283957-session-var-is-not-stored/#findComment-1458518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.