inkexit Posted July 2, 2010 Share Posted July 2, 2010 Hi All. I'm trying to do something fairly simply, I hope. I have a computer program running on my home desktop that outputs a txt file. It can not be changed to output anything else or connect directly to my database online. I'm simply trying to come up with some php code that can read from this txt file and then update a given cell in a given table and database I have online. I've taken care of most of the basics. I have a pro website online with mysql and php set up on it. I used phpmyadmin to create a new user and a new table. I have turned on external access at my host for my home IP address. I have XAMPP installed and running on my home PC. I'd just like to know if what I want to do is possible and what the best way to go about it is. The txt file gets updates from the windows program pretty frequently, perhaps every second or so. Are there any good tutorials about how to do this? Or it'd be really awesome if there was freeware piece of software that I'd just have to select the txt file in and setup my database info and it will be good to go? thanks for looking all. Link to comment https://forums.phpfreaks.com/topic/206565-remote-access-to-mysql/ Share on other sites More sharing options...
inkexit Posted July 2, 2010 Author Share Posted July 2, 2010 Here's what I have so far. Most of it is commented out and not working, I can't even seem to get the echo command to work right. I placed the file in the htdocs directory of XAMPP. This is supposed to be the 'live' folder on my pc where I can web serve from, according to the XAMPP manual. But needless to say its not working. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php echo "php working<br />"; mysql_connect("MyHost", "MyUser", "MyPass") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("MyDB") or die(mysql_error()); echo "Connected to MyDB"; //read from txt file //$myFile = "testFile.txt"; //$fh = fopen($myFile, 'r'); //$signal = fread($fh, 1); //fclose($fh); //if($signal=="1") //{ //$result = mysql_query("UPDATE MyDB SET Data='1') or die(mysql_error()); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/206565-remote-access-to-mysql/#findComment-1080460 Share on other sites More sharing options...
inkexit Posted July 3, 2010 Author Share Posted July 3, 2010 bump Link to comment https://forums.phpfreaks.com/topic/206565-remote-access-to-mysql/#findComment-1080794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.