RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

First Post This Forum! : PhP - Auto Update MySQL

Vorspire

Knight
First Post This Forum! : PhP - Auto Update MySQL

w00t for the first post of this forum!

Is it possible to make a php script that will automatically take data from a .txt file and enter it into tables in MySQL on LocalHost?

If so, how can i make MyRunUO upload to an FTP instead of ODBC to the Database, as the database i use does not support external connection...

:D
 

Phantom

Knight
Admin Vorspire said:
w00t for the first post of this forum!

Is it possible to make a php script that will automatically take data from a .txt file and enter it into tables in MySQL on LocalHost?

If so, how can i make MyRunUO upload to an FTP instead of ODBC to the Database, as the database i use does not support external connection...

:D

Why don't you make it support an external connection. There is no reason you can't, can even only allow connections from a certain ip/dns address.

The answer to your question, is yes its possible, but it wouldn't perform very well.
 

LightShade

Sorceror
Try something like this

I didn't test this, but I think this is what you're looking for....

PHP:
mysql_connect("localhost","username","password") or die ("Couldn't Connect to Server...");
mysql_select_db("database") or die ("Couldn't Connect to Database...");
$fp = fopen("test.txt", "r");
while (!feof)
{
$text = fgets($fp, 255);
$query ="INSERT INTO table (field)";
$query.=" VALUES ('$text')";
$result=mysql_query($query);
}
 

MuadDib

Wanderer
You could always make the php script to run on your shard pc as cmdline task through the task scheduler and do it that way. Does your host allow non-local host connections to the mysql databases?

Or, Modify the server to fire that connection and do the same. Send the text file's info through the connection in the server. I've done very similar in the past, using a shard script to update a mysql db on the fly from an in game command (listing of all npc types and such). Was not on RunUO though, but, with the C# it should be very easily done.
 
Top