| | |
Parse error, unexpected T_STRING on line 26, but I don't see it
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2004
Posts: 1
Reputation:
Solved Threads: 0
<?
$connect = mysql_connect("localhost", "adamf", "adamf123") or
die ("Wrong password, jerk.");
mysql_select_db ("adamf");
$insert="INSERT INTO product (product_id, product_name, product_type, product_brand, product_year)
VALUES (1, 'Cyber', 1, 1, 2001),
(2, 'Motive', 8, 1, 2005),
(3, 'Oracle', 8, 2, 2005)";
$results = mysql_query($insert)
or die(mysql_error());
$type="INSERT INTO producttype (producttype_id, producttype_label)
VALUES (1, 'Heads'),
(2, 'Shafts'),
(3, 'Helmets'),
(4, 'Gloves'),
(5, 'Arm Pads'),
(6, 'Shoulder Pads'),
(7, 'Stringing'),
(8, 'New'),
$results=mysql_query($type)
or die(mysql_error());
echo "Data inserted successfully!";
?>
okay, line 26 is the "echo "Data inserted successfully!"; line, so, my guess is the line above it has the error. However, I don't see what the heck it could be. I'm pretty much copying this out of the wrox book "PHP, Apache, MySQL Web Developement", just with different words and other such things, so it isn't a movie site. I've probably looked at this for 20 minutes, could anybody tell me what's wrong?
$connect = mysql_connect("localhost", "adamf", "adamf123") or
die ("Wrong password, jerk.");
mysql_select_db ("adamf");
$insert="INSERT INTO product (product_id, product_name, product_type, product_brand, product_year)
VALUES (1, 'Cyber', 1, 1, 2001),
(2, 'Motive', 8, 1, 2005),
(3, 'Oracle', 8, 2, 2005)";
$results = mysql_query($insert)
or die(mysql_error());
$type="INSERT INTO producttype (producttype_id, producttype_label)
VALUES (1, 'Heads'),
(2, 'Shafts'),
(3, 'Helmets'),
(4, 'Gloves'),
(5, 'Arm Pads'),
(6, 'Shoulder Pads'),
(7, 'Stringing'),
(8, 'New'),
$results=mysql_query($type)
or die(mysql_error());
echo "Data inserted successfully!";
?>
okay, line 26 is the "echo "Data inserted successfully!"; line, so, my guess is the line above it has the error. However, I don't see what the heck it could be. I'm pretty much copying this out of the wrox book "PHP, Apache, MySQL Web Developement", just with different words and other such things, so it isn't a movie site. I've probably looked at this for 20 minutes, could anybody tell me what's wrong?
•
•
Join Date: Jul 2004
Posts: 234
Reputation:
Solved Threads: 8
[PHP]<?
$connect = mysql_connect("localhost", "adamf", "adamf123") or
die ("Wrong password, jerk.");
mysql_select_db ("adamf");
$insert="INSERT INTO product (product_id, product_name, product_type, product_brand, product_year)
VALUES (1, 'Cyber', 1, 1, 2001),
(2, 'Motive', 8, 1, 2005),
(3, 'Oracle', 8, 2, 2005)";
$results = mysql_query($insert)
or die(mysql_error());
$type="INSERT INTO producttype (producttype_id, producttype_label)
VALUES (1, 'Heads'),
(2, 'Shafts'),
(3, 'Helmets'),
(4, 'Gloves'),
(5, 'Arm Pads'),
(6, 'Shoulder Pads'),
(7, 'Stringing'),
(8, 'New')";
$results=mysql_query($type)
or die(mysql_error());
echo "Data inserted successfully!";
?>[/PHP]
According to your error, in your code you forgot to put "; in the end of $type sentence. Hope it works. If this is not, insert data row by row.
$connect = mysql_connect("localhost", "adamf", "adamf123") or
die ("Wrong password, jerk.");
mysql_select_db ("adamf");
$insert="INSERT INTO product (product_id, product_name, product_type, product_brand, product_year)
VALUES (1, 'Cyber', 1, 1, 2001),
(2, 'Motive', 8, 1, 2005),
(3, 'Oracle', 8, 2, 2005)";
$results = mysql_query($insert)
or die(mysql_error());
$type="INSERT INTO producttype (producttype_id, producttype_label)
VALUES (1, 'Heads'),
(2, 'Shafts'),
(3, 'Helmets'),
(4, 'Gloves'),
(5, 'Arm Pads'),
(6, 'Shoulder Pads'),
(7, 'Stringing'),
(8, 'New')";
$results=mysql_query($type)
or die(mysql_error());
echo "Data inserted successfully!";
?>[/PHP]
According to your error, in your code you forgot to put "; in the end of $type sentence. Hope it works. If this is not, insert data row by row.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Jun 2009
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
I'm sure he heard you. By the way, can I borrow your necronomicon so I can resurrect the dead as well? Come on, this thread is over 5 years old
Probably he will not hear me, but oder IT curious like me will see the answer. I'm not a IT professional. Just learning a little bit.
See you.
![]() |
Similar Threads
- Help! Parse error: parse error, unexpected T_STRING (PHP)
- Parse error, unexpected T_STRING, expecting T_CASE (PHP)
- parse error, unexpected T_STRING in (PHP)
- Parse error: parse error, unexpected T_STRING on line 12 (PHP)
- Please Help! parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING (PHP)
- PHP Parse error: parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING in /home/thei2k9/public_html/includes/f (PHP)
Other Threads in the PHP Forum
- Previous Thread: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
- Next Thread: update student record
| Thread Tools | Search this Thread |
301 ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dynamic echo email eregi error execution file files folder foreach form forms function functions google href htaccess html httppost image include insert integration ip java javascript joomla library limit link links login loop mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem query radio random recursion regex remote script search searchbox server session sessions sms soap source space sql syntax system table tutorial update upload url validator variable video volume votedown web website xml youtube zend






