•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,003 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 2,368 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: 1756 | Replies: 7
![]() |
•
•
Join Date: Jul 2007
Posts: 25
Reputation:
Rep Power: 2
Solved Threads: 0
I'm trying to learn php and I'm trying to build a simple form that stores data. However, I'm getting this error message when I submit my form:
Parse error: parse error, unexpected T_STRING in /sites/yuma2/swaters210/home/public_html/music/music.php on line 7
you check out my form here: http://www.stevenwaters.net/music/index.html
FYI: I do know I have to replace password with an actual password, which I have.
Can someone check it out for me? I would appreciate it. I was going to post in a similiar thread, but wasn't sure if anybody would see it.
Parse error: parse error, unexpected T_STRING in /sites/yuma2/swaters210/home/public_html/music/music.php on line 7
you check out my form here: http://www.stevenwaters.net/music/index.html
<?
$artist=$_POST['artist'];
$song=$_POST['song'];
$album=$_POST['album'];
mysql_connect("localhost", "swaters210", "password") or die(mysql_error());
mysql_select_db("swaters210") or die(mysql_error());
CREATE TABLE data (artist VARCHAR(30), song VARCHAR(30), album VARCHAR(30));
mysql_query("INSERT INTO `data` VALUES ('$artist', '$song', '$album')");
Print "Your information has been successfully added to the database.";
?>
FYI: I do know I have to replace password with an actual password, which I have.
<form method="POST" action="music.php"> <label for="artist"><b>Artist Name:</b></label> <input type="text" name="artist" value="" /><br /> <label for="song"><b>Song Title:</b></label> <input type="text" name="song" value="" /><br /> <label for="album"><b>Album:</b></label> <input type="text" name="album" value="" /><br /> <input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
Can someone check it out for me? I would appreciate it. I was going to post in a similiar thread, but wasn't sure if anybody would see it.
•
•
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation:
Rep Power: 2
Solved Threads: 10
What is this ?!?
- Mitko Kostov
sql Syntax (Toggle Plain Text)
CREATE TABLE DATA (artist VARCHAR(30), song VARCHAR(30), album VARCHAR(30));
- Mitko Kostov
Last edited by MitkOK : Jul 8th, 2007 at 8:58 am.
•
•
Join Date: Jul 2007
Posts: 25
Reputation:
Rep Power: 2
Solved Threads: 0
How do you wrap it in a mysql_query() statement? I was just following this tutorial here:
http://php.about.com/od/phpbasics/ss/mysql_files_2.htm
http://php.about.com/od/phpbasics/ss/mysql_files_2.htm
the purpose of this, is just to check if the SQL table actually exists before you INSERT data into it. If you're sure that the table exists (that you've created it), then you won't need this, its just to stop noobies from doing insert's into a table that doesnt' exist
GardCMS :: Open Source CMS :: Gardcms.org
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Parse error: parse error, unexpected T_STRING on line 12 (PHP)
- Please Help! parse error, unexpected T_STRING (PHP)
- Parse Error T_STRING - Help Please (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)
- Need Help With Parse Error... (PHP)
Other Threads in the PHP Forum
- Previous Thread: Simple include() problem
- Next Thread: Class question


Linear Mode