ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
333 stars 133 forks source link

getting data from database to esp8266 #142

Closed SayedBaqer closed 4 years ago

SayedBaqer commented 4 years ago

Hi, i want your help to read some data from SQL to esp8266, as i need to get last row with with column 1,3,7,13,14,15 in the table if specific column is 0, how to implement it if you could help

    <table>
          <?php 
          if($result!==FALSE){

             $row = mysqli_fetch_array($result,MYSQLI_NUM);
             printf("
    <tr class='output'>
    <td>Last Update: %s</td>
    </tr>
    <td class='output'>Temperature: %s degree C</td>
    </tr>
    <tr class='output'>
    <td>Humidity: %s %% </td>
    </tr>
    <tr class='output'>
    <td>Running Days: %s</td>
    </tr>
    <tr class='output'>
    <td>Number Of Turn: %s</td>
    </tr>
    </tr>
    <tr class='output'>
    <td><input id='Reload' class='smallbtn-text' type='button' value='Reload' /></td>
    </tr>", 
                   $row[1], $row[3], $row[7],$row[13], $row[14], $row[15]);
             mysqli_free_result($result);
             mysqli_close($connection);
          }else{
              print("Error!");
          }
        ?>

    </table>
ChuckBell commented 4 years ago

Yes, I can help you, but I need a bit more information. And, I would ask you to attempt to create your sketch first. You can use one of the example sketches provided and the Wiki (documentation) to help learn what you need to do.

What you've provided here isn't an Arduino sketch. Start there.

Aside from that, if you get stuck, I'll need to know which version of MySQL you are using, and some examples of the data you're trying to retrieve. As it is now, I am not sure what you're asking; whether you're talking about literal column numbers, or row data.

Please attempt a sketch first (start small with the connect example) then build until you either get it working or get stuck. If you get stuck, look at the other entries in this forum for possible solutions before opening a new issue for a specific error. :)