473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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:
<?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
2 4069
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
5
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword')...
4
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
13
by: Anne Bos | last post by:
After uploading a php file I got back the error message 'unexpected T_STRING on line 1'. Line 1 is <?php session_start() ?>. The servers php version is 5.2.1. By the way, what is a T_STRING. I...
6
by: goodguyjam | last post by:
Hi all, I'm having trouble with mysql. I've just finished my php coding for HTTP authentication and with some help am now getting a login window pop up whenever I click on a link on my website...
21
by: Jordan79 | last post by:
I have uploaded a file and am now trying to store it in a DB. I am getting a "Parse error: syntax error, unexpected T_STRING" error on this line below: INSERT INTO gallery (user_id, image_name) ...
3
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 ...
11
by: JRough | last post by:
I'm trying to use output buffering to cheat so i can print to excel which is called later than this header(). header("Content-type: application/xmsdownload"); header("Content-Disposition:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.