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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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

?>

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.