User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 373,930 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,240 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 68412 | Replies: 1
Reply
Join Date: Jul 2004
Posts: 1
Reputation: raine is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
raine raine is offline Offline
Newbie Poster

Parse error, unexpected T_STRING on line 26, but I don't see it

  #1  
Jul 30th, 2004
<?
$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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Posts: 187
Reputation: PoA is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
PoA PoA is offline Offline
Junior Poster

Re: Parse error, unexpected T_STRING on line 26, but I don't see it

  #2  
Jul 31st, 2004
[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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:54 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC