Jump to content

Parse error: syntax error, unexpected T_STRING in mysql Instert


blink359

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.