Akenatehm Posted November 22, 2008 Share Posted November 22, 2008 Hey Guys, I am trying to set a script up that will read the information from one of my tables and display it in an xml file. Here is my code. Any help would be enormously appreciated. Thanks Aken <?PHP $link = mysql_connect("localhost","username","password"); mysql_select_db("kaurlcom_messenger"); $query = 'SELECT * FROM users'; $results = mysql_query ($query); echo "<?xml version=\"1.0\"?>\n"; echo "<users>\n"; while ($line = mysql_fetch_assoc($results)) { echo "<username>" . $line["username"] . "</username>\n"; } echo "</users>\n"; mysql_close($link); ?> Link to comment https://forums.phpfreaks.com/topic/133750-cant-query-mysql-database-and-get-it-to-write-to-an-xml-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 22, 2008 Share Posted November 22, 2008 It would be enormously helpful if you told us what it was or was not doing? What do you see in front of you when you try it? Here are some possibilities - Php is not installed and working. Mysql is not installed and working. The mysql extension in php is not installed and working. The mysql_connect is failing because of wrong database credentials. The msyql_select_db is failing because of a wrong database name. The code is generating a syntax error. The mysql_query is failing because of a wrong table name. The <?xml tag is not causing the output in the browser to be formatted as xml. There are no rows in the database. Just posting code and stating or implying that it does not work is pointless. Narrow the problem down for us please. Link to comment https://forums.phpfreaks.com/topic/133750-cant-query-mysql-database-and-get-it-to-write-to-an-xml-file/#findComment-696038 Share on other sites More sharing options...
Akenatehm Posted November 22, 2008 Author Share Posted November 22, 2008 Hey. I am very sorry for not being as specific as I could be. Whenever i try and browse to the php file e.g. www.url.com/file.php it says page cannot be found. I just spoke with a friend and he said it was because I don't have an index.php file. I don't know exactly what to put in that file. My friend and I are trying to create an Instant Messaging Client with Flash. We want this PHP file to get users from the database and post the information into an XML file which will be accessed via Action SCript. Link to comment https://forums.phpfreaks.com/topic/133750-cant-query-mysql-database-and-get-it-to-write-to-an-xml-file/#findComment-696042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.