Creating your own IoT Cloud from scratch using php, Mysql, ESP12E

Creating your own IoT cloud from scratch using php, Mysql, ESP12E – Part 2.1

Introduction

This is Part 2.1 of  "Creating your own IoT cloud from scratch using php, Mysql, ESP12E ".  If you are seeing this tutorial directly then I will recommend you to read the Introduction of this tutorial first.

So in the previous chapter, you already have seen the video. In this chapter, you will get the source code. Simply follow the instructions step by step in the video and the instructions in the below code.

(Note : The chapter 2.1 (the current chapter) contains code of only 'weather'. For code of 'led' visit chapter 2.2)

(Important : For those who have already gone through first part of this tutorial. To avoid confusion, I am giving the index of this chapter with information for this chapter.

  1. Chapter 2 - Detailed introduction, instructions and full video of the tutorial.
  2. Chapter 2.1 - Source Code of weather updating php api.
  3. Chapter 2.2 - Source code of led controlling php api.

)

Code

Below php api is for 'weather' table.

1. Create a new folder named 'api'. Then inside the 'api' folder, create  a new folder again and name it 'weather'

2. After that copy and paste this following programming in notepad++ or any code editor and save it as 'dbconfig.php'. Don't forget to replace your database credentials in the below code.

3. Then copy and paste the below code and save it as 'db_connect.php'.

4. Copy and paste the below code and save it as 'delete.php'.

5. After that copy and paste the below program and save it as 'insert.php'.

6. Make a new file and copy and paste this program below and save it as 'read_all.php'.

7. Save the below file as 'specific.php'.

8. The copy and paste the below program and save it as 'update.php'.

Support me by by subscribing to my YouTube channel by hitting the below button.

youtube-iotmonk-subscribe

Please login to get access to the quiz
Creating your own IoT Cloud from scratch using php, Mysql, ESP12E – Part 2 (Prev Lesson)
(Next Lesson) Creating your own IoT cloud from scratch using php, Mysql, ESP12E – Part 2.2
Back to Creating your own IoT Cloud from scratch using php, Mysql, ESP12E

Comments ( 35 )

  • Samo

    Hi,

    thanks for your great video tutorials. I went step by step. Copy yours codes to notepad++ and save it like in tutorials. But when I test it with Postman, he give me

    Unexpected ‘W’. I dont find mistakes. Do you know what is wrong?

    Thanks you for your comment

    • Please crosscheck again while copy pasting. That is where majority of the people make mistakes. Thank you for your appreciation. Please share this website with your friends. 🙂

      • Kumanan

        Hi ! i too getting error on post man posting ” unexpected ‘>’.

        • I think, you didn’t set the php version. Please check it once again.

      • Rajat

        I went step by step. Copy yours codes to notepad++ . But when I test it with Postman, he give me Unexpected ‘W’.

        • Either :
          1. Your php version is not correct
          2. There is typo in your code.

  • Abdallah Arshad

    whenever i run the microcontroller it keeps saying parse object() failed and closing connection it never reaches the part where the led is controlled

    • Most of the time its minor things you miss. Please just don’t copy paste things. I have explained everything in video. Carefully watch it again. A lot of people have already executed it successfully.

  • Renan Oliveira

    Please post the arduino IDE code
    Thanks !

    • Please check the other page, code is already given.

  • Hi,
    Thank you for such a great tutorial, I follower your step by step but when I am inserting the values from ‘insert.php’ ; The values are not storing in my database instead of that it showing……
    {
    “success”: 0,
    “message”: “Something has been wrong”
    }
    but the readall.php & delete.php were working properly…
    please help me

    • Hi manishk, Please check the api and the values you are passing. Mostly it is typos.

  • Lawrence

    sir..i try your project with a little twist.. i use ultrasonic sensor and lm35 sensor..
    i got this error when upload my nodemcu to server.
    ………………………………………………………..
    Warning: mysql_connect(): ProxySQL Error: Access denied for user ‘id833499_jantomjr’@’2a02:4780:bad:f00d::17’ (using password: YES) in /storage/ssd4/999/8334999/public_html/api/sensor/db_connect.php on line 26
    ProxySQL Error: Access denied for user ‘id833499_jantomjr’@’2a02:4780:bad:f00d::17’ (using password: YES)
    Warning: mysql_close(): no MySQL-Link resource supplied in /storage/ssd4/999/8334999/public_html/api/sensor/db_connect.php on line 38

    • Its the problem of permission. Please follow the steps in tutorial carefully again.

    • Tutul

      don’t use localhost as server..this may be helful..use blank..

      • Thanks for the input. I appreciate it.

  • Bakul

    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /storage/ssd3/207/8629207/public_html/api/db_connect.php:26
    Stack trace:
    #0 /storage/ssd3/207/8629207/public_html/api/db_connect.php(8): DB_CONNECT->connect()
    #1 /storage/ssd3/207/8629207/public_html/api/insert.php(21): DB_CONNECT->__construct()
    #2 {main}
    thrown in /storage/ssd3/207/8629207/public_html/api/db_connect.php on line 26

    this error when i run insert.php then write temp & hum value

    • 1. Check php version
      2. Check the code

    • Shivam

      even im getting the same error

      • Shivam

        sir crossed checked with code too…but i dont know about php version. which version should we use???

        • It is php 5.2. It is already shown in the video.

      • It is php 5.2. It is already shown in the video.

  • Gaurav bedge

    hello you are awesome
    urgent error :- something went wrong
    i have checked for php version which is 5.2 and also checked for insert.php still postman is showing this error
    pls help asap
    mail me pls

  • Shivam

    sir, in postman tool while instering data it shows this msg
    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /storage/ssd4/364/8901364/public_html/APi/db_connect.php:26

    what could be the possible reason for it

  • Akash

    I did everything as u mentioned in the tutorial but when i test insert with postman it shows – unexpected ‘W’. Please guide me through this.

    • Either :
      1. Your php version is not correct
      2. There is typo in your code.
      3. mysql settings not done properly.

  • DINA

    hello , thanks for your tutorial , i really need it for my final project study , the data doesnt insert on database from postman
    {
    “success”: 0,
    “message”: “Parameter(s) are missing. Please check the request”
    }
    i update php version to 5.2
    however read_all it works normally

    • Check if it is post or get request in postman.

  • Rajat

    Warning: mysql_connect(): ProxySQL Error: Access denied for user ‘id9031356_agriculture’@’2a02:4780:bad:f00d::4’ (using password: YES) in /storage/ssd5/356/9031356/public_html/api/db_connect.php on line 26
    ProxySQL Error: Access denied for user ‘id9031356_agriculture’@’2a02:4780:bad:f00d::4’ (using password: YES)
    Warning: mysql_close(): no MySQL-Link resource supplied in /storage/ssd5/356/9031356/public_html/api/db_connect.php on line 38

    • Either :
      1. Your php version is not correct
      2. There is typo in your code.
      3. mysql settings not done properly.

  • Yogesh gunjal

    im watching your nodemu wiyh iot part 2
    while im testing insert API FOLLOWING ERROR HAS OCCUR plzzzz give a solution ASAP

    • I have already answered that.

  • Yogesh gunjal

    ERROR as mention above

    ProxySQL Error: Access denied for user ‘id9121796_wp_dc38ced00d4c317bef4cdc7702ff2331’@’2a02:4780:bad:f00d::4’ (using password: YES)

    • Your settings do not seem to be done properly.Please follow the tutorial again.

Post a Reply