Book Image

Internet of Things Programming with JavaScript

Book Image

Internet of Things Programming with JavaScript

Overview of this book

The Internet of Things is taking the tech world by storm, and JavaScript is at its helm. This book will get you to grips with this exciting new technology. Where do Node.js, HTML5 and Windows 10 IoT Core come in with JavaScript and IoT? Why Raspberry Pi Zero rather than Arduino? How do you configure and build an IoT network from scratch? All your IoT JavaScript questions are answered in this book.
Table of Contents (15 chapters)
Internet of Things Programming with JavaScript
Credits
About the Author
www.packtpub.com
Customer Feedback
Preface

Data queries from the database


It's important to have data recorded and to make some queries to have the data show in the web page.

Software for the scripts

Here we have the scripts that we used to show the data in the page:

You can now either copy the code inside a file called query1.php, or just get the complete code from the folder for this project:

<!DOCTYPE html> 
  <html> 
    <body> 
<h1>Clik on the buttons to get Data from  MySQL</h1> 
<form action="query1.php" method="get"> 
<input type="submit" value="Get all Data">  
</form> 
</br> 

<form action="query2.php" method="get"> 
<input type="submit"value="Humidity <= 15"> 
</form>  
</br> 

<form action="query3.php" method="get"> 
<input type="submit" value="Temperature <=25">  
</form> 
</br> 
<?php 

$con=mysql_connect("localhost...