Akenatehm Posted November 23, 2008 Share Posted November 23, 2008 Hey Guys, I am trying to make a script that sends data from a form to a mysql table. It seems like it is connecting to the database fine but then it comes up with the following error: Parse error: syntax error, unexpected T_STRING in /home/kaurlcom/public_html/testform.php on line 39 Here is the code: <?php include "connect.php"; if(isset($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $email=$_POST['email']; if(strlen($username)<1) { print "You did not enter a username."; } else if(strlen($password)<1) { print "You did not enter a password."; } else { $insert="Insert into users (username,password,email) values('$username','$password','$email')"; mysql_query($insert) or die("Could not insert comment); } } ?> Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/ Share on other sites More sharing options...
samona Posted November 23, 2008 Share Posted November 23, 2008 you didnt close your quotations on the die() function on line 37. Use the code below and try again. <?php include "connect.php"; if(isset($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $email=$_POST['email']; if(strlen($username)<1) { print "You did not enter a username."; } else if(strlen($password)<1) { print "You did not enter a password."; } else { $insert="Insert into users (username,password,email) values('$username','$password','$email')"; mysql_query($insert) or die("Could not insert comment"); } } ?> Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696623 Share on other sites More sharing options...
Akenatehm Posted November 23, 2008 Author Share Posted November 23, 2008 Oh, I see. Thank you very much. I'll try it now. Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696626 Share on other sites More sharing options...
Akenatehm Posted November 23, 2008 Author Share Posted November 23, 2008 Still says unexpected T_STRING on line 39. Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696629 Share on other sites More sharing options...
Akenatehm Posted November 23, 2008 Author Share Posted November 23, 2008 Don't worry. It works, my fault. I didn't upload in correct place. Thanks heaps for ur help. Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696632 Share on other sites More sharing options...
webmaster1 Posted November 23, 2008 Share Posted November 23, 2008 Don't forget to close the door on the way out! (mark thread as solved) Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696635 Share on other sites More sharing options...
Akenatehm Posted November 23, 2008 Author Share Posted November 23, 2008 Sorry about that. Completely Forgot. Thanks for All Your Guys Help Link to comment https://forums.phpfreaks.com/topic/133845-solved-unexpected-t_string/#findComment-696637 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.