I need some help with PHP (i'm kind of newbie)
Posted: Mon Mar 24, 2008 10:27 am
<?php
$con = mysql_connect("localhost","user","pwr");
mysql_select_db("radiobor_radio", $con);
$query = 'SELECT songs.url_song as url_song,artist.description as artist,songs.description as description,songs.url_art_song as url_art 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_assoc($result) )
{
echo "<xsong" . " surl=\"" . $row["url_song"] . "\" " . "sartist=\"" . $row["artist"] . "\" " . "strack=\"" . $row["description"] . "\" " . "sart=\"" . $row["url_art"] . "\" " . "/>\n";
}
mysql_close($con);
echo "</xsongs>\n";
-------------------------------------------------------------------------------
This PHP script generates a XML file by selecting a mysql database. When I upload this script into my server it works perfectly but when I try to test it on my computer a get the following result:
\n"; echo "\n"; while ( $row = mysql_fetch_assoc($result) ) { echo "\n"; } mysql_close($con);
echo "\n"; ?>
I'm using Uniform Server to manage Apache and mysql. I think I got something to do with setting or stuff, but I'm not sure. It is like Internet Explorer does not recognize php.
$con = mysql_connect("localhost","user","pwr");
mysql_select_db("radiobor_radio", $con);
$query = 'SELECT songs.url_song as url_song,artist.description as artist,songs.description as description,songs.url_art_song as url_art 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_assoc($result) )
{
echo "<xsong" . " surl=\"" . $row["url_song"] . "\" " . "sartist=\"" . $row["artist"] . "\" " . "strack=\"" . $row["description"] . "\" " . "sart=\"" . $row["url_art"] . "\" " . "/>\n";
}
mysql_close($con);
echo "</xsongs>\n";
-------------------------------------------------------------------------------
This PHP script generates a XML file by selecting a mysql database. When I upload this script into my server it works perfectly but when I try to test it on my computer a get the following result:
\n"; echo "\n"; while ( $row = mysql_fetch_assoc($result) ) { echo "\n"; } mysql_close($con);
echo "\n"; ?>
I'm using Uniform Server to manage Apache and mysql. I think I got something to do with setting or stuff, but I'm not sure. It is like Internet Explorer does not recognize php.