alivec Posted March 17, 2008 Share Posted March 17, 2008 Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\checklogin.php on line 15 i get this error when i enter this script please help.. <? $host = "localhost"; $username = ""; $password = ""; $db_name ="alivecsetup"; $tbl_name ="members"; mysql_connect($host, $username, $password) or die ("Can't Connect"); mysql_select_db($db_name) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'" $result = mysql_query($sql); $count = mysql_num_rows($result); if($count==1) { Session_register("myusername"); Sesion_register("mypassword"); header("location:login_success.php"); } else { Echo "Wrong username or password"; } ?> Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/ Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'" should be $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; you are missing the ; Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493722 Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 thanks but i have another error that im getting Fatal error: Call to undefined function session_is_registerd() in C:\xampp\htdocs\login\login_success.php on line 3 <? $host = "localhost"; $username = "root"; $password = ""; $db_name ="alivecsetup"; $tbl_name ="members"; mysql_connect($host, $username, $password) or die ("Can't Connect"); mysql_select_db($db_name) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result = mysql_query($sql); $count = @mysql_num_rows($result); if($count==1){ Session_register("myusername"); Session_register("mypassword"); header("location:login_success.php"); } else { Echo "wrong username or password"; } ?> thank you in advance Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493736 Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 we need the code for this page login_success.php Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493740 Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 <? session_start(); if(!session_is_registerd(myusername)) { header("location:mainlogin.php"); } ?> that is login_success.php Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493747 Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 Where is the function session_is_registered set at. or is it supposed to be if (!isset($_SESSION['myusername'])) Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493749 Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 if (!isset($_SESSION['myusername'])) is supposed to be it Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493752 Share on other sites More sharing options...
Jeremysr Posted March 17, 2008 Share Posted March 17, 2008 You misspelled it: session_is_registered() instead of session_is_registerd() Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493764 Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 You misspelled it: session_is_registered() instead of session_is_registerd() I completely missed that, better go back to school Link to comment https://forums.phpfreaks.com/topic/96471-unexpected-t_variable/#findComment-493765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.