blink359 Posted July 21, 2010 Share Posted July 21, 2010 Im having a problem making an insert script i keep getting Parse error: syntax error, unexpected T_STRING in /home/a9855336/public_html/mail.php on line 46 and im not sure what to do here is my code 32<form action="mail.php" method="post"> 33Name: <input type="text" name="name" /><br /> 34Email: <input type="text" name="email" /><br /> 35<input type="submit" /> 36</form> 37<?php 38$mysql_host = "mysql12.000webhost.com"; 39$mysql_database = "a9855336_mail"; 40$mysql_user = "a9855336_root"; 41$mysql_password = "n4th4n"; 42 43mysql_connect("$mysql_host","$mysql_host","$mysql_password"); 44mysql_select_db("$mysql_database); 45 46mysql_query("INSERT INTO mail 47(name, email) VALUES('$_POST['name']', '$_POST['email']' ) ") 48or die(mysql_error()); 49 50echo "Email Address Added"; 51 52mysql_close 53?> The numbers are to represent line numbers due to the irellivency of putting up the whole file as its just the layout of the website they aer not actually in my script Thanks, Blink359 Link to comment https://forums.phpfreaks.com/topic/208401-parse-error-syntax-error-unexpected-t_string-in-mysql-instert/ Share on other sites More sharing options...
Mchl Posted July 21, 2010 Share Posted July 21, 2010 You have: 1. missing quote in line 44 2. array values in double quotes not put in {} mysql_query("INSERT INTO mail (name, email) VALUES('{$_POST['name']}', '{$_POST['email']}' ) ") Link to comment https://forums.phpfreaks.com/topic/208401-parse-error-syntax-error-unexpected-t_string-in-mysql-instert/#findComment-1089032 Share on other sites More sharing options...
blink359 Posted July 21, 2010 Author Share Posted July 21, 2010 Thanks Link to comment https://forums.phpfreaks.com/topic/208401-parse-error-syntax-error-unexpected-t_string-in-mysql-instert/#findComment-1089037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.