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

You forgot to terminate the line that contains

mysql_select_db("musiclist", $conn)

it should be:

mysql_select_db("musiclist", $conn);

-matt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.