Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 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. return $connection;
  25.  
  26. echo "Abrindo conexao...<br>";
  27.  
  28. $link=Connection();
  29.  
  30. echo "Conectado.<br>Executando query...<br>";
  31.  
  32. $result=mysql_query("SELECT * FROM `Dados Arduino` ORDER BY `timeStamp` DESC",$link);
  33.  
  34. if ( !empty( $err = mysql_error() ) ) {
  35. echo $err;
  36. } else {
  37. echo "Query executada com sucesso.";
  38. }
  39. ?>
  40.  
  41. <table border="2" cellspacing="1" cellpadding="0">
  42. <tr>
  43. <td align='center' width='160px'>
  44. <b>&nbsp;Tensão&nbsp;</b>
  45. </td>
  46. <td align='center' width='160px'>
  47. <b>&nbsp;Corrente&nbsp;</b>
  48. </td>
  49. <td align='center' width='160px'>
  50. <b>&nbsp;Tempo1&nbsp;</b>
  51. </td>
  52. <td align='center' width='160px'>
  53. <b>&nbsp;Tempo2&nbsp;</b>
  54. </td>
  55. <td align='center' width='160px'>
  56. <b>&nbsp;Horario&nbsp;</b>
  57. </td>
  58. </tr>
  59. <?php
  60. if($result!==FALSE){
  61. while($row = mysql_fetch_array($result)) {
  62. printf("
  63. <tr>
  64. <td align='center'> &nbsp;%s </td>
  65. <td> &nbsp;%s&nbsp; </td>
  66. <td> &nbsp;%s&nbsp; </td>
  67. <td> &nbsp;%s&nbsp; </td>
  68. <td> &nbsp;%s&nbsp; </td>
  69. </tr>",
  70. $row["timeStamp"], $row["Tensao"], $row["Corrente"], $row["Tempo1"], $row["Tempo2"], $row["Horario"]);
  71. }
  72. mysql_free_result($result);
  73. mysql_close();
  74. }
  75. ?>
  76. </table>
  77. </body>
  78. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement