Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // database access parameters
- session_start();
- if(!session_is_registered(vegpont_id)){
- header("location:login.php");
- }
- $host = "xx.xx.x.xxx";
- $user = "xxxx_xxxxx";
- $pass = "xxxx";
- $db = "xxxx_xxx";
- $connection = pg_connect ("host=$host dbname=$db user=$user password=$pass");
- if (!$connection)
- {
- die("Could not open connection");
- }
- $myusername=$_POST['myusername'];
- $mypassword=$_POST['mypassword'];
- $vegpont_id=$_POST['vegpont_id'];
- $_SESSION['vegpont_id'];
- // generate and execute a query
- $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' ";
- $result=pg_query($query);
- // get the number of rows in the resultset
- $rows = pg_num_rows($result);
- echo "There are currently $rows records in the database.";
- // close database connection
- pg_close($connection);
- $rows = pg_num_rows($result);
- // if records present
- if ($rows > 0)
- {
- // iterate through resultset
- for ($i=0; $i<$rows; $i++)
- {
- $row = pg_fetch_array($result, $i, PGSQL_ASSOC);
- ?>
- <li><font size="-1"><b><?php echo $row['consumption'];
- ?></b></font>
- <br>
- <font size="-1"><?php echo $row['ugyfel_id']; ?></font>
- <p>
- <?php
- }
- }
- // if no records present
- // display message
- else
- {
- ?>
- <font size="-1">No data available.</font>
- <?php
- }
- // close database connection
- pg_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement