| | |
PHP5 - MySQL Parse error:
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hey,
i'm trying to insert data into my database with PHP5
i've created this code,
<?
//open the connection
$conn = mysql_connect("localhost", "user", "pass");
//pick the database to use
mysql_select_db("musiclist", $conn)
//create SQL statement
$sql = "INSERT INTO musiclist (artist, title)";
$sql.= "VALUES (";
$sql.= "'John Denver', 'Thank God I'm A Country Boy')";
//execute the SQL statement
if(mysql_query($sql, $conn))
{echo "record added!";}
else
{echo "something went worng!";}
?>
and to my eyes it looks good, but i keep getting this error
Parse error: syntax error, unexpected T_VARIABLE in C:\www\leewalsh\php\musiclist.php on line 17
this is line 17
$sql = "INSERT INTO musiclist (artist, title)";
i don't really understand it fully yet so any help woul be great
--Walyer
Walyer's Playpen
i'm trying to insert data into my database with PHP5
i've created this code,
<?
//open the connection
$conn = mysql_connect("localhost", "user", "pass");
//pick the database to use
mysql_select_db("musiclist", $conn)
//create SQL statement
$sql = "INSERT INTO musiclist (artist, title)";
$sql.= "VALUES (";
$sql.= "'John Denver', 'Thank God I'm A Country Boy')";
//execute the SQL statement
if(mysql_query($sql, $conn))
{echo "record added!";}
else
{echo "something went worng!";}
?>
and to my eyes it looks good, but i keep getting this error
Parse error: syntax error, unexpected T_VARIABLE in C:\www\leewalsh\php\musiclist.php on line 17
this is line 17
$sql = "INSERT INTO musiclist (artist, title)";
i don't really understand it fully yet so any help woul be great
--Walyer
Walyer's Playpen
•
•
Join Date: Oct 2005
Posts: 27
Reputation:
Solved Threads: 0
You forgot to terminate the line that contains
it should be:
-matt
PHP Syntax (Toggle Plain Text)
mysql_select_db("musiclist", $conn)
it should be:
PHP Syntax (Toggle Plain Text)
mysql_select_db("musiclist", $conn);
-matt
![]() |
Similar Threads
- Help. Parse error in PHP code (PHP)
- PHP Parse error: parse error, unexpected T_STRING in F:\downloads\cats-0.6.1\index.ph (PHP)
- Parse error please help (PHP)
- PHP Parse error: parse error, unexpected T_STRING (PHP)
- I need help with a parse error! (PHP)
- Parse error, syntax error, Forbids declaration (C++)
Other Threads in the PHP Forum
- Previous Thread: Please help me!!!
- Next Thread: help please i am a php dummy :eek:
Views: 4082 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access address ajax apache api array autoincrement beginner binary broken cakephp checkbox class cms code cron curl database date dehasher directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu method methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query question radio random recursion regex remote script search select server sessions sms soap source space speed sql structure support! syntax system table tutorial update updates upload url validation validator variable video web xml youtube





