470,575 Members | 1,877 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,575 developers. It's quick & easy.

unexpected T_STRING - MySQL Input

Hey everyone,
I'm new to PHP, and to MySQL. I want this script to allow me to input a
value from a form (name) into a MySQL table (test table in test
database). Here's the form:
<form action="sql.php" method="POST">
Name:<input type="text" name="name" maxlength="10">
<br /> <input type="submit" name="submit" value="Submit Data">
And here's sql.php:
// Make a MySQL Connection
mysql_connect("localhost", "*****", "*****") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());


// Insert a row of information into the table "films"
mysql_query("INSERT INTO test
(name) VALUES('$name') ");
or die(mysql_error());

echo "Data Inserted!";
Any help would be greately appreciated!

Jul 17 '05 #1
2 3934
Also, I get this error message when I try to submit the form:
Parse error: parse error, unexpected T_STRING in
/home/cinema-t/public_html/gfsbeta/test/sql.php on line 9

Jul 17 '05 #2
Start at line 9 and work your way backwards looking for a missing
semi-colon, bracket, or paren. More then likely you forgot one.

<snip from above>$name=$_POST['name'] </snip from above>
like in this line

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Anne Bos | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.