Jump to content

[SOLVED] Script that Writes Data from a MySQL Database to an XML File


Akenatehm

Recommended Posts

Hey Guys,

 

I was wondering if anyone knew of a PHP script that will write data from a mysql database into an XML File. I don't need the PHP script to display anything but to just write the data from the database to the xml file at a time interval.

 

Help would be greatly appreciated.

 

Thanks in Advanced

Akenatehm

There are two ways:

 

You can post it in Freelancing section and hope someone willing to do it (for a price or otherwise)

 

or

 

You can try to do it by yourself, and if you have problems, ask questions here, and you surely will be helped. Just show that you're willing to learn.

 

 

First thing that I would advise you to do, is to learn how to connect PHP to MySQL.

 

Here's manual page for mysqli extension, that will be useful. Take a look at Example #1 and try to do it yourself.

 

 

So far I have this script:

 

<?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);

?>

 

Still says error, page cannot found....before when I got it to load locally it came up with a whole lot of errors but thats about it... Any ideas to fix?

 

Do you have an MSN or Yahoo that I can add so we can talk through this problem easier?

Do you have any other files on this account? Can you open them in the browser?

Maybe you should try to create a simple HTML page, and try to open it to see if it loads all right (which will tell us, that all is OK with your server)

 

404 error is not caused by script itself, but most likely because you've placed script in wrong place or you're typing in wrong url.

 

Sorry, I don't use neither MSN nor Yahoo, and besides it's getting late here... I guess someone else will have to try to help you... I'll be back tomorrow ;)

 

Good luck

 

No, not in htaccess but I may have deleted when I was using Dreamweaver. The FTP Sync on there is not the best. Yes I am using cPanel. It just worked now. But when I deleted it from the server to try an updated version nothing has changed and it still loads the page normally in both chrome and ie even though in the file browser in the cPanel, it shows the file as not there.

I also just noticed that there is no .htaccess file in the root directory of my site and when I save it as another file name like original file is called test and then the second one is test2 it says that test2 doesn't exist

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.