Advertisement
Guest User

Untitled

a guest
Jun 6th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <?php
  2. // database access parameters
  3. session_start();
  4. if(!session_is_registered(vegpont_id)){
  5. header("location:login.php");
  6. }
  7. $host = "xx.xx.x.xxx";
  8. $user = "xxxx_xxxxx";
  9. $pass = "xxxx";
  10. $db = "xxxx_xxx";
  11.  
  12. $connection = pg_connect ("host=$host dbname=$db user=$user password=$pass");
  13. if (!$connection)
  14. {
  15. die("Could not open connection");
  16. }
  17. $myusername=$_POST['myusername'];
  18. $mypassword=$_POST['mypassword'];
  19. $vegpont_id=$_POST['vegpont_id'];
  20. $_SESSION['vegpont_id'];
  21.  
  22. // generate and execute a query
  23. $query = "SELECT consumption, direction FROM l_modemflow_monthly_2010_07 WHERE vegpont_id='vegpont_id' AND tol LIKE '2010-07-02%' AND ig LIKE '2010-07-02%' AND billing='1' ";
  24. $result=pg_query($query);
  25. // get the number of rows in the resultset
  26. $rows = pg_num_rows($result);
  27. echo "There are currently $rows records in the database.";
  28. // close database connection
  29. pg_close($connection);
  30.  
  31. $rows = pg_num_rows($result);
  32. // if records present
  33. if ($rows > 0)
  34. {
  35. // iterate through resultset
  36. for ($i=0; $i<$rows; $i++)
  37. {
  38. $row = pg_fetch_array($result, $i, PGSQL_ASSOC);
  39. ?>
  40. <li><font size="-1"><b><?php echo $row['consumption'];
  41. ?></b></font>
  42. <br>
  43. <font size="-1"><?php echo $row['ugyfel_id']; ?></font>
  44. <p>
  45. <?php
  46. }
  47. }
  48. // if no records present
  49. // display message
  50. else
  51. {
  52. ?>
  53. <font size="-1">No data available.</font>
  54. <?php
  55. }
  56. // close database connection
  57. pg_close($connection);
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement