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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
skinnycat
Forum Newbie
Posts: 4
Joined: Fri Mar 21, 2008 5:20 pm

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

Post 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";
?>
User avatar
DaveTheAve
Forum Contributor
Posts: 385
Joined: Tue Oct 03, 2006 2:25 pm
Location: 127.0.0.1
Contact:

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

Post 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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

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

Post by Benjamin »

Wrong forum :evil:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post by Chris Corbyn »

:arrow: Moved to PHP Code
Post Reply