bleured27 Posted July 15, 2012 Share Posted July 15, 2012 help please next error Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/register2.php on line 47 <?php $host="localhost"; $username=""; $password=""; $db_name="test"; $tbl_name="userinfo"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $mypassword2=$_POST['mypassword2']; $email=$_POST['email']; $email2=$_POST['email2']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $mypassword2 = stripslashes($mypassword2); $email = stripslashes($email); $email2 = stripslashes($email2); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $mypassword2 = mysql_real_escape_string($mypassword2); $email = mysql_real_escape_string($email); $email2 = mysql_real_escape_string($email2); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ echo"name already used" ; } else{ if ($mypassword != $mypassword1){ echo"you filld in 2 diffrend passwords"; } else{ if ($email != $email1{ echo"you filld in 2 diffrend emails"; } else{ ini_set('display_errors', 1); // 0 = uit, 1 = aan error_reporting(E_ALL); function checkemail($email) { if(!stristr($email, '@')) { return false; } $email_split = explode("@", $email); if(count($email_split) != 2) { return false; } $email_user = $email_split[0]; $email_host = $email_split[1]; if(!getmxrr($email_host, $var)) { return false; } if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user)) { return false; } return trsue; } $email = (isset($_POST['email'])) ? $_POST['email'] : ''; if(!checkemail($email)) { echo 'not failid email<br />'; } else { $sql="SELECT * FROM $tbl_name WHERE email='$email'"; $result2=mysql_query($sql2); $count2=mysql_num_rows($result2); if($count2==1){ echo"email already used" } else { mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )"); echo"registred succesfull,you can login now"; } } } } } ?> MOD EDIT: . . . tags added. Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/ Share on other sites More sharing options...
Pikachu2000 Posted July 15, 2012 Share Posted July 15, 2012 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361658 Share on other sites More sharing options...
bleured27 Posted July 15, 2012 Author Share Posted July 15, 2012 OKEY can you find error? Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361659 Share on other sites More sharing options...
Pikachu2000 Posted July 15, 2012 Share Posted July 15, 2012 The problem is on the line before the line that is reported in the error message. There's something missing from it. Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361661 Share on other sites More sharing options...
bleured27 Posted July 15, 2012 Author Share Posted July 15, 2012 can you tell me what i am totaly blind now Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361662 Share on other sites More sharing options...
bleured27 Posted July 15, 2012 Author Share Posted July 15, 2012 or do you mean this nothing missing here Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/register2.php on line 47 im on a mac is that something that help you my mac SKILLS are 0 Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361663 Share on other sites More sharing options...
Nyuszer Posted July 15, 2012 Share Posted July 15, 2012 line 46 if ($email != $email1) { Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361665 Share on other sites More sharing options...
Pikachu2000 Posted July 15, 2012 Share Posted July 15, 2012 if( $email != $email1 { What goes here? -----^ Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361666 Share on other sites More sharing options...
bleured27 Posted July 15, 2012 Author Share Posted July 15, 2012 tnx that helped now i got this Parse error: syntax error, unexpected '}', expecting ',' or ';' in /Applications/XAMPP/xamppfiles/htdocs/register2.php on line 102 <code> <?php $host="localhost"; $username=""; $password=""; $db_name="test"; $tbl_name="userinfo"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $mypassword2=$_POST['mypassword2']; $email=$_POST['email']; $email2=$_POST['email2']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $mypassword2 = stripslashes($mypassword2); $email = stripslashes($email); $email2 = stripslashes($email2); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $mypassword2 = mysql_real_escape_string($mypassword2); $email = mysql_real_escape_string($email); $email2 = mysql_real_escape_string($email2); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ echo"name already used" ; } else{ if ($mypassword != $mypassword1){ echo"you filld in 2 diffrend passwords"; } else{ if ($email != $email1){ echo"you filld in 2 diffrend emails"; } else{ ini_set('display_errors', 1); // 0 = uit, 1 = aan error_reporting(E_ALL); function checkemail($email) { if(!stristr($email, '@')) { return false; } $email_split = explode("@", $email); if(count($email_split) != 2) { return false; } $email_user = $email_split[0]; $email_host = $email_split[1]; if(!getmxrr($email_host, $var)) { return false; } if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user)) { return false; } return trsue; } $email = (isset($_POST['email'])) ? $_POST['email'] : ''; if(!checkemail($email)) { echo 'not failid email<br />'; } else { $sql="SELECT * FROM $tbl_name WHERE email='$email'"; $result2=mysql_query($sql2); $count2=mysql_num_rows($result2); if($count2==1){ echo"email already used" } else { mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )"); echo"registred succesfull,you can login now"; } } } } } ?> </code> Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361667 Share on other sites More sharing options...
bleured27 Posted July 15, 2012 Author Share Posted July 15, 2012 oops i mean <?php $host="localhost"; $username=""; $password=""; $db_name="test"; $tbl_name="userinfo"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $mypassword2=$_POST['mypassword2']; $email=$_POST['email']; $email2=$_POST['email2']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $mypassword2 = stripslashes($mypassword2); $email = stripslashes($email); $email2 = stripslashes($email2); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $mypassword2 = mysql_real_escape_string($mypassword2); $email = mysql_real_escape_string($email); $email2 = mysql_real_escape_string($email2); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ echo"name already used" ; } else{ if ($mypassword != $mypassword1){ echo"you filld in 2 diffrend passwords"; } else{ if ($email != $email1){ echo"you filld in 2 diffrend emails"; } else{ ini_set('display_errors', 1); // 0 = uit, 1 = aan error_reporting(E_ALL); function checkemail($email) { if(!stristr($email, '@')) { return false; } $email_split = explode("@", $email); if(count($email_split) != 2) { return false; } $email_user = $email_split[0]; $email_host = $email_split[1]; if(!getmxrr($email_host, $var)) { return false; } if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user)) { return false; } return trsue; } $email = (isset($_POST['email'])) ? $_POST['email'] : ''; if(!checkemail($email)) { echo 'not failid email<br />'; } else { $sql="SELECT * FROM $tbl_name WHERE email='$email'"; $result2=mysql_query($sql2); $count2=mysql_num_rows($result2); if($count2==1){ echo"email already used" } else { mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )"); echo"registred succesfull,you can login now"; } } } } } ?> can some one eddit that? Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361675 Share on other sites More sharing options...
Nyuszer Posted July 22, 2012 Share Posted July 22, 2012 line 101: echo"email already used"; if you get parse error, always check the line mentioned in the error and the line before that Quote Link to comment https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1363593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.