Go Down

Topic: phpmyadmin database - Send and receive data using arduino (6 steps) - tutorial (Read 390 times) previous topic - next topic

udbhav95

Hi guys. I was struggling with codes to send and receive data from my phpmyadmin database using Arduino, but all in vain. I finally found a way to do that using JSON (Java Script Object Notation). So I decided to make a video of the complete process, right from creating a phpmyadmin database to receiving data from it in a local variable on Arduino IDE.

Here's the complete process: https://youtu.be/6hi9Wf99hfg

No one has to struggle much now, do they? ;)

xl97

There have been several examples posted here...

All files needed included..  (even the DB set-up)


Examples:
http://forum.arduino.cc/index.php?topic=452765.msg3134238#msg3134238

http://forum.arduino.cc/index.php?topic=396991.0


So nobody really needed to struggle if they bothered to search a little bit!  :)

* and if "I" can do it.... countless others can too! :)

I would also suggest you either update to using PDO or you sanitize your data before doing your INSERT..etc..  (as it is, it is wide open for SQL injection exploits)  :smiley-eek-blue:

couple more things...

* I'm not clear as to why each time you 'upload your code' the same value(s) get repeated another time?

* You did not demonstrate how to actually PARSE OUT any meaningful JSON data?  From the quick look at the video.. it looks like you just dump out all the markup..  including all HTML tags..etc..etc..

Might be helpful for your target audience to learn how to strip out the data that actually means something to them instead of all the other garbage.




udbhav95

Hi. I understand. Although what they're trying to achieve in these two examples is somewhat different.

Quote
Examples:
http://forum.arduino.cc/index.php?topic=452765.msg3134238#msg3134238

http://forum.arduino.cc/index.php?topic=396991.0
And sure..

Quote
You did not demonstrate how to actually PARSE OUT any meaningful JSON data?  From the quick look at the video.. it looks like you just dump out all the markup..  including all HTML tags..etc..etc..
Actually, after all the coding my brain was so fucked up that it seemed pretty easy to parse out the necessary data from the server response using the string functions rather than to retrieve the server response in a local variable on your arduno IDE.

But anyways thanks for your opinion. 

xl97

Hi. I understand. Although what they're trying to achieve in these two examples is somewhat different.

And sure..

Actually, after all the coding my brain was so fucked up that it seemed pretty easy to parse out the necessary data from the server response using the string functions rather than to retrieve the server response in a local variable on your arduno IDE.

But anyways thanks for your opinion.  
While the project had different 'goals'.. the core steps and code are there..

Setting up the database
Using the Arduino/Ethernet/ESP (whatever) to call a PHP script
PHP example of how to select as well as insert..

Quote
Actually, after all the coding my brain was so fucked up that it seemed pretty easy to parse out the necessary data from the server response using the string functions rather than to retrieve the server response in a local variable on your arduno IDE.
Fair enough.....  but you didnt show that part (that I recall at least) on how to parse out the actually required data/JSON..

IMHO.. it just be better to return the JSON data by itself...

Also dont forget security!  Sanitize your data!...  :)


udbhav95

Quote
Fair enough.....  but you didnt show that part (that I recall at least) on how to parse out the actually required data/JSON..
Actually, I did. Even made a video of it.

https://youtu.be/5lMQM7PmylQ

Quote
Also dont forget security!  Sanitize your data!...
Sure. Still working on it.

xl97

Actually, I did. Even made a video of it.

https://youtu.be/5lMQM7PmylQ
Actually you didnt.  You made a completely -new- video...  (not quite the same thing) ... it was not in your original video posted in your original post.  :)

But glad you updated and made a new video...  should help others who are looking into this.


udbhav95

Actually you didnt.  You made a completely -new- video...  (not quite the same thing) ... it was not in your original video posted in your original post.  :)
That's what I meant by 'Actually, I did. Even made a video of it.'.

Go Up