Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Python, HTML, PHP - what to do?

General discussions related to php

Moderators: macek, egami, gesf

Python, HTML, PHP - what to do?

Postby txpress79 » Thu Aug 14, 2014 2:00 pm

All,

I'm working on a project that will involve several Raspberry Pi's. Each Pi will have the same image and same scripts installed. Each Pi will upload two text files four times a day. The files will have a unique ID number, followed by comma separated values.

I'm stuck trying to figure out the best way to upload these files and have php process the data for input into mysql databases. The major problem is that each Pi will be uploading files of the same names, and I fear data being over-written. With 200 Pi's, that's 800 files every day. I'll certainly have a race issue.

Any thoughts on the best way to go about this?
txpress79
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Aug 14, 2014 1:55 pm

Re: Python, HTML, PHP - what to do?

Postby landi » Thu Aug 14, 2014 3:04 pm

Assuming you can't use some part of the Pi that will have to be different (such as IP address), how about: Have each Pi do a request to a page on the central server that returns a unique value, and then use that unique value as a prefix on the file names. The image on each Pi remains the same, but the filenames are different.
landi
New php-forum User
New php-forum User
 
Posts: 236
Joined: Thu Mar 15, 2012 3:59 pm

Re: Python, HTML, PHP - what to do?

Postby txpress79 » Fri Aug 15, 2014 4:58 am

I've decided to create a text file with a single numeric value that will be used to identify the Pi (1001, 1002...). From that, I can create the file names as 1001gps.txt and 1001rfid.txt. Assuming I can upload via FTP to the server, what is the best method for extracting the data for input into mysql?

I've dealt with PHP and MySQL before, but it always required user input (HTML form). What do you recommend I do here?
txpress79
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Aug 14, 2014 1:55 pm


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron