| | |
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:
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





