Writing to CSV database file from php application - php

I have a simple PHP/HTML application (hosted on Heroku) which runs a survey. I would like to save the responses to this survey (only 4/5 questions) to a CSV file for later analysis. These responses are currently saved as PHP variables so a form submission is not possible at the moment.
What is the best way to do this? I'm assuming this would be easiest using Javascript but am open to suggestions. Also, should I put the CSV file on a different server?

Related

Submit PDF Form Data to Database

What is the most efficient and simplest way to submit a filled in PDF form that resides on a users local machine (not on the server) to a database? is this possible? I have looked online and have seen CGI being mentioned a lot but I prefer to use something like PHP.
If the document resided on the server then using something like PHP would not be so difficult to handle this, but what if the PDF document is sitting on a local machine? What approach can we take to send the data over to a database then?

Send csv file to mySql database every 2 mins?

I'm generating a new csv file (approx) every 2 mins on my machine through a local application that I've written, and I need this file to update my database each time it is generated. I've successfully done this locally via a (scheduled) repeating bat file, and now I need to move this process online so my website has access to this data in as similar of a time-frame as possible.
I'm totally green on mySql and learning it as I go, so I was wondering if there is anything I should be concerned about or any best practices I should follow for this task.
Can I connect directly to my server-side database from my cmd window (bat file) and send this data once the process has run and generated the csv file? Or do I need to upload this file via ftp/php to my webserver and import it into the database once it is online?
Any help/thoughts would be greatly appreciated.

General CURL and Order of operations

This is a very general question but I'm not sure the best way to go about things here.
I have two applications that want to interface. One is a Windows based app that has a database and can send CURL commands. The other is a very simple website with a MySQL database.
The main feature is that these two apps can swap database data between each other. The Windows app is currently using SQLAnywhere but could be converted to MySQL.
Anyway: On the web app there is a js function to dump all data requested into a .txt file, essentially a mysql dump. This function will be called by the Windows app via CURL. It will say
"Hey, dump the data for this table in to a txt file, then let me download it."
What I am unsure of is: Once the request to dump the data is complete, the Windows app will want the file right away. How do I say back to it, "Wait until the file is completed, and then you can download it."
I was thinking of making a dummy file and then a .txt file so the Windows app essentially gets stuck in a loop (with a timeout) until the file is renamed to .txt. Is this a good way to approach this?
Thank you.

Fill PDF Form From Local Database using PHP

My goal is to create a way fill a PDF form from a database. I have an inventory of items that I want to track and would like to do so by outputting to an existing pdf form. I would like to use a database that can easily be edited by a gui like access (that is installed on the computers at work). I am on work computers and am not sure if I will be able to run an exe's on them(like trying to use java with iText).
That sums up my goals and issues. I am very new to programming and was thinking I could do this with a webpage and have the database and the pdf form all stored in the same file and use the webpage to make queries to fill the pdf form while using access to edit the database for the inventory.
It appears php would be the best way to do this but it looks like php requires a server to run its code. So I was thinking I could host the php code on a server and attempt to access a the database at work using the db's shared drive location. Since I am new to database I am not sure if that is possible or if I would need to have the database hosted on a server.
Does anyone have any recommendations on how I could accomplish this. I was thinking about just having it all server based but I signed up for 1and1 hosting to experiment with and its MySQL database cannot be accessed remotely. I guess this is not a big problem but it would require me to develop my own gui for db editing.
I am not necessarily looking for code examples, just big picture ideas on how to accomplish this.

how to upload files to PHP server with use of Python?

I was wondering is there any tutorial out there that can teach you how to push multiple files from desktop to a PHP based web server with use of Python application?
Edited
I am going to be writing this so I am wondering in general what would be the best method to push files from my desktop to web server. As read from some responses about FTP so I will look into that (no sFTP support sadly) so just old plain FTP, or my other option is to push the data and have PHP read the data thats being send to it pretty much like Action Script + Flash file unloader I made which pushes the files to the server and they are then fetched by PHP and it goes on from that point on.
I'm assuming you own the PHP server.
Use FTP. See here and here.
Make a file upload form with PHP, and use python to fill out the form. See this and this.
(Usually a bad idea) Use PHP to write small server that listens for data and then writes it to a file.
I think you're referring to a application made in php running on some website in which case thats just normal HTTP stuff.
So just look at what name the file field has on the html form generated by that php script and then do a normal post. (urllib2 or whatever you use)

Categories