By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,626 Members | 1,929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,626 IT Pros & Developers. It's quick & easy.

unexpected T_STRING - MySQL Input

P: n/a
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:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "*****", "*****") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

$name=$_POST['name']

// 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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
lig
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.