curt girl Posted January 25, 2011 Share Posted January 25, 2011 Hello ..Im so glad to be here with u all I am a novice in the use of this php/sql and I have to complete my project..but Unfortunately, I got this problem and I couldent figure out where the mistake lies.. please any advice here u my code <html> <body background="3d-background-blue.jpg"> <?php $x1=$_POST['fname']; $x2=$_POST['age']; $x3=$_POST['password']; $x4=$_POST['email']; $x5=$_POST['yourtype']; mysql_connect("localhost","root","")or die("there is a problem "); mysql_select_db("order1")or die("no DB"); // check if the username is taken $check = "select id from users where fname = '$x1'"; $qry = mysql_query($check) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows != 0) { echo "Sorry, there the username $x1 is already taken. "; echo "Try again"; echo "<a href= iinterface.html >home</a>"; echo "<br>"; exit(); } else { // insert the data $query="insert into users (fname,age,password,email,type) values('$x1','$x2','$x3','$x4','$x5')"; $result=mysql_query($query); if($result){ echo "thanks for registering $x1 " ;echo "<br>"; echo "the date of registeration is "; Echo gmdate ("D, d M Y H:i:s"); echo "<br>"; echo "<br>"; echo "<a href=iinterface.html > back to main </a>"; echo "<br>"; } else {echo"insertion error"; } ?> </body> </html> the massege of error is : Parse error: parse error in insert2.php on line 45 Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/ Share on other sites More sharing options...
avvllvva Posted January 25, 2011 Share Posted January 25, 2011 You missed one close brace '}' for else else { // insert the data put one '}' at end. Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164946 Share on other sites More sharing options...
curt girl Posted January 25, 2011 Author Share Posted January 25, 2011 OOPS thats right it works ...I did not expect to respond so quickly, thank you very much Mr.avvllvva and It seems I'll be here often all respect regard to you.. Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164949 Share on other sites More sharing options...
mraza Posted January 25, 2011 Share Posted January 25, 2011 its best to use some editor which shows line numbers so you can trace an error if acccord, i personaly use notepad++, it display line numbers in code. Regards Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164953 Share on other sites More sharing options...
curt girl Posted January 25, 2011 Author Share Posted January 25, 2011 its best to use some editor which shows line numbers so you can trace an error if acccord, i personaly use notepad++, it display line numbers in code. Regards Thank u so much .. I appreciate I will take your advice in my consideration.. Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164965 Share on other sites More sharing options...
parino_esquilado Posted January 25, 2011 Share Posted January 25, 2011 LaughOutLoud!! Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164968 Share on other sites More sharing options...
curt girl Posted January 25, 2011 Author Share Posted January 25, 2011 LaughOutLoud!! thank u .. Link to comment https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/#findComment-1164973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.