| | |
parse error, unexpected T_STRING in
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2007
Posts: 26
Reputation:
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
PHP Syntax (Toggle Plain Text)
<? $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.
PHP Syntax (Toggle Plain Text)
<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.
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 9:58 am.
•
•
Join Date: Jul 2007
Posts: 26
Reputation:
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
![]() |
Similar Threads
- 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
| Thread Tools | Search this Thread |
apache api array autocomplete beginner binary body broken cakephp class cms code cron curl database dataentry date date/time display duplicates dynamic ebooks email emptydisplayvalue error execute explodefunction file firstoptioninphpdroplist folder form forms function functions google href htaccess html image include ip javasciptvalidation javascript joomla keywords limit link list login matching mediawiki menu msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter paypal pdf php phpincludeissue query random recourse recursive regex script search seo server sessions shot source sp space speed sql static subdomain subscription system table tag tutorial tutorials update upload url validator variable vbulletin video web webdesign white xml youtube





