Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Excel To HTML using codebeautify.org</title>
  5. </head>
  6. <body>
  7. <?php
  8.  
  9. echo "Iniciando<br>";
  10.  
  11.  
  12. echo "Iniciando Connection()";
  13. $server="localhost";
  14. $user="hid1728660_h22stein";
  15. $pass="hvo123";
  16. $db="id1728660_medidor";
  17.  
  18. $connection = mysql_connect($server, $user, $pass);
  19.  
  20. echo "Error: " . mysql_error();
  21.  
  22.  
  23. mysql_select_db($db) or die( 'MySQL ERROR: '. mysql_error() );
  24.  
  25. echo "Abrindo conexao...<br>";
  26.  
  27.  
  28. echo "Conectado.<br>Executando query...<br>";
  29.  
  30. $result=mysql_query("SELECT * FROM `Dados Arduino` ORDER BY `timeStamp` DESC",$connection);
  31.  
  32. if ( !empty( $err = mysql_error() ) ) {
  33. echo $err;
  34. } else {
  35. echo "Query executada com sucesso.";
  36. }
  37. ?>
  38.  
  39. <table border="2" cellspacing="1" cellpadding="0">
  40. <tr>
  41. <td align='center' width='160px'>
  42. <b>&nbsp;Tensão&nbsp;</b>
  43. </td>
  44. <td align='center' width='160px'>
  45. <b>&nbsp;Corrente&nbsp;</b>
  46. </td>
  47. <td align='center' width='160px'>
  48. <b>&nbsp;Tempo1&nbsp;</b>
  49. </td>
  50. <td align='center' width='160px'>
  51. <b>&nbsp;Tempo2&nbsp;</b>
  52. </td>
  53. <td align='center' width='160px'>
  54. <b>&nbsp;Horario&nbsp;</b>
  55. </td>
  56. </tr>
  57. <?php
  58. if($result!==FALSE){
  59. while($row = mysql_fetch_array($result)) {
  60. printf("
  61. <tr>
  62. <td align='center'> &nbsp;%s </td>
  63. <td> &nbsp;%s&nbsp; </td>
  64. <td> &nbsp;%s&nbsp; </td>
  65. <td> &nbsp;%s&nbsp; </td>
  66. <td> &nbsp;%s&nbsp; </td>
  67. </tr>",
  68. $row["timeStamp"], $row["Tensao"], $row["Corrente"], $row["Tempo1"], $row["Tempo2"], $row["Horario"]);
  69. }
  70. mysql_free_result($result);
  71. mysql_close();
  72. }
  73. ?>
  74. </table>
  75. </body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement