Page 1 of 1

need help with an error msg (i'm new on php)

Posted: Fri Mar 21, 2008 5:25 pm
by skinnycat
I'm trying to read a DB and generate a XML file to later read it in another aplication but I'm getting the following msg :

Parse error: syntax error, unexpected T_DNUMBER, expecting ',' or ';' in /home/radiobor/public_html/playlist.php on line 13

I have no idea what that means.

***** PLEASE MAKE READABLE POSTS AND USE THE CODE TAG ******

Code: Select all

<?php
$con = mysql_connect("localhost");
if (!$con)
{
    echo "'Could not connect: ' . mysql_error()";
}
 
mysql_select_db("radiobor_radio", $con);
$query = "SELECT songs.url_song,artist.description,songs.description,songs.url_art_song FROM songs,artist WHERE songs.artist_id = artist.artist_id";
 
$result = mysql_query($query);
 
echo "<?xml version="1.0" encoding="UTF-8"?>\n";
echo "<xsongs>\n";
 
while($row = mysql_fetch_array($result))
{
    echo "<xsong>" . $row['surl'] . " " . $row['sartist'] . $row['strackl'] . " " . $row['sart'] . "</xsong>\n";
}
mysql_close($con);
echo "</xsongs>\n";
?>

Re: need help with an error msg (i'm new on php)

Posted: Fri Mar 21, 2008 6:36 pm
by DaveTheAve
Here is your issue:

Code: Select all

echo "<?xml version="1.0" encoding="UTF-8"?>\n";
You forgot to escape your double-quotes in your double quotes like so:

Code: Select all

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
Good luck!

Edit: Forgot to mention this is the wrong forum area to be posting this in.

Re: need help with an error msg (i'm new on php)

Posted: Fri Mar 21, 2008 11:40 pm
by Benjamin
Wrong forum :evil:

Re: need help with an error msg (i'm new on php)

Posted: Fri Mar 21, 2008 11:42 pm
by Chris Corbyn
:arrow: Moved to PHP Code