Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. $host="localhost"; //replace with your hostname
  3. $username="phpmyadmin"; //replace with your username
  4. $password="1234"; //replace with your password
  5. $db_name="phpmyadmin"; //replace with your database
  6. $con=mysql_connect("$host", "$username", "$password")or die("cannot connect");
  7. mysql_select_db("$db_name")or die("cannot select DB");
  8. $sql = "SELECT * from TurnonLED"; //replace emp_info with your table name
  9. $result = mysql_query($sql);
  10. $json = array();
  11. if(mysql_num_rows($result)){
  12. while($row=mysql_fetch_row($result)){
  13. $json['TurnonLED'][]=$row;
  14.  
  15. }
  16. }
  17. mysql_close($db_name);
  18. echo json_encode($json);
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement