r/programmingrequests • u/Fliwatt • Jan 21 '20
PHP script that stores three values in MySQL database
Hey guys,
I am currently working on a little home automation project where I need to pass variables between my Tasker on my Android phone and a Python script over the internet. I just need to store one integer value and two strings that can be updated and read in easily.
Unfortunately it is my first time working with either MySQL and PHP and I am constantly failing which is really frustrating to me. I just want two simple php files, one that can store a given value and another one that can output it so I can read it with an HTTP get request. If you guys have any other ideas how I could do that I would really appreciate it. I would like to spend more time coding the actual project than I do right now trying to learn MySQL databases and PHP which is really frustrating me.
Any help is greatly appreciated.
1
u/djandDK Jan 21 '20
W3schools have some good examples of how to connect PHP and MySQL. They also show how you can get data from MySQL with PHP
The value you need stored, will it need a webui or will it just take a post request? Also when a new value is inserted, should the old one be overwritten or should both be saved in the MySQL database?
Of course this subreddit is targeted more towards having someone make something for you, so I would like to know if that is what you want?
1
u/JMejia5429 Jan 24 '20
Put whichvar in the single quote