Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.09 KB | None | 0 0
  1. This is what I have.
  2.  
  3. <?PHP
  4.  
  5. # OLYMPUS OFFICE MANAGEMENT SYSTEM - NEXT GENERATION GROUP PTY. LTD
  6. # This website was designed for the sole use of the Next Generation Group PTY. LTD.
  7. # All other uses for this website must be authorised by the creators.
  8. # All additions to the website must be completed by the creators.
  9.  
  10. # START DATE: 1058 hours MON 23 AUG 2010
  11. # FILE: inc/pdf_view-client.php
  12.  
  13. # This file contails all of the client pages and includes.
  14. ####################################### FUNCTIONS FOR THE PAGE #######################################
  15. function connect()
  16. {      
  17.     $database_server = "localhost";
  18.     $database_user = "darcy_admin";
  19.     $database_password = "password";
  20.     $database_name = "darcy_nextgensys";
  21.  
  22.     $connection = mysql_connect($database_server, $database_user, $database_password);
  23.     if (!$connection)
  24.     {
  25.         die('Connnection to '.$database_server.' as '.$database_user.' could not be established due to the following error: ' . mysql_error());
  26.     }  
  27.     mysql_select_db($database_name, $connection) or die('The database could not be selected due to the following error:' . mysql_error());
  28. }
  29.  
  30. function chooseQuery()
  31. {
  32.     // If $_GET[query] is equal to 'view-allocation' perform the following:
  33.     if($_GET['query'] == "view-allocation")
  34.     {
  35.         // If $_GET[sid] and $_GET['date'] are set perform the following:
  36.         if(isset($_GET['sid']) & isset($_GET['date']))
  37.         {
  38.             $table = "`_CLIENTS`";
  39.             $where_col_1 = "salesperson";
  40.             $where_value_1 = $_GET['sid'];
  41.             $where_col_2 = "dateassigned";
  42.             $where_value_2 = $_GET['date'];
  43.    
  44.             $query = "SELECT * FROM ".$table." WHERE ".$where_col_1."='".$where_value_1."' AND ".$where_col_2."='".$where_value_2."'";
  45.             $result = mysql_query($query) or die('Search for all records in '.$table.' where '.$where_col_1.' is equal to '.$where_value_1.' and '.$where_col_2.' is equal to '.$where_value_2.' was not completed. '.mysql_error());
  46.         }
  47.         // If $_GET[sid] is set perform the following:
  48.         if(isset($_GET['sid']) & !isset($_GET['date']))
  49.         {
  50.             $table = "`_CLIENTS`";
  51.             $where_col = "salesperson";
  52.             $where_value = $_GET['sid'];
  53.    
  54.             $query = "SELECT * FROM ".$table." WHERE ".$where_col."='".$where_value."'";
  55.             $result = mysql_query($query) or die('Search for all records in '.$table.' where '.$where_col.' is equal to '.$where_value.' was not completed. '.mysql_error());
  56.         }
  57.         // If $_GET['date'] is set perform the following:
  58.         if(!isset($_GET['sid']) & isset($_GET['date']))
  59.         {
  60.             $table = "`_CLIENTS`";
  61.             $where_col = "dateassigned";
  62.             $where_value = $_GET['date'];
  63.    
  64.             $query = "SELECT * FROM ".$table." WHERE ".$where_col."='".$where_value."'";
  65.             $result = mysql_query($query) or die('Search for all records in '.$table.' where '.$where_col.' is equal to '.$where_value.' was not completed. '.mysql_error());
  66.         }
  67.         // Count the number of results.
  68.         $numrows = mysql_num_rows($result);
  69.         // THIS IS WHAT I WANT TO REPEAT!!!!
  70.         $multi = While ($date = mysql_fetch_array($result))
  71.         {  
  72.             $name_full = $data['name_title'].' '.$data['name_first'].' '.$data['name_last'];
  73.             $telemarketer = $data['telemarketer'];
  74.             $salesperson = $data['salesperson'];
  75.             $phone_personal = $data['phone_personal'];
  76.             $phone_mobile = $data['phone_mobile'];
  77.             $phone_business = $data['phone_business'];
  78.             $phone_fax = $data['phone_fax'];
  79.             $email_personal = $data['email_personal'];
  80.             $dateassigned = $data['dateassigned'];
  81.            
  82.             // Query the Staff Table for the Clients Telemarketer
  83.             $table = "`_STAFF`";
  84.             $where_col = "sid";
  85.             $where_value = $telemarketer;
  86.    
  87.             $query = "SELECT * FROM ".$table." WHERE ".$where_col."='".$where_value."'";
  88.             $result = mysql_query($query) or die('Search for all records in '.$table.' where '.$where_col.' is equal to '.$where_value.' was not completed. '.mysql_error());  
  89.             $data = mysql_fetch_array($result);
  90.             $telemarketer = $data['name_first'].' '.$data['name_last'];
  91.  
  92.             // Query the Staff Table for the Clients Salesperson
  93.             $table = "`_STAFF`";
  94.             $where_col = "sid";
  95.             $where_value = $salesperson;
  96.  
  97.             $query = "SELECT * FROM ".$table." WHERE ".$where_col."='".$where_value."'";
  98.             $result = mysql_query($query) or die('Search for all records in '.$table.' where '.$where_col.' is equal to '.$where_value.' was not completed. '.mysql_error());  
  99.             $data = mysql_fetch_array($result);
  100.             $salesconsultant = $data['name_first'].' '.$data['name_last'];
  101.            
  102.             $table = 'blehnewss imagine there is a table printing info here';
  103.         }
  104.            
  105.         }
  106.     }
  107. }
  108.  
  109. function choosePDF()
  110. {
  111.     if($_GET['query'] == "view-client")
  112.     {
  113.         require('script_pdftable.php');
  114.         class PDF extends PDFTable
  115.         {
  116.             // Page Header
  117.             function Header()
  118.             {
  119.                 parent::Header();
  120.                 // Display the Logo.
  121.                 $this->Image('../img/logo_medium.jpg',10,8,80);
  122.                 // Set the Font.
  123.                 $this->SetFont('Helvetica','B','24');
  124.                 // Display the Page Title.
  125.                 $this->Cell(0,5,'LEAD SHEET',0,1,'R');
  126.                 // Reset the Font.
  127.                 $this->SetFont('Helvetica','',10);
  128.                 // Line Break to Space
  129.                 $this->Ln(10);
  130.             }
  131.         }
  132.         $client = new PDF();
  133.         $client->AddPage();
  134.         $client->SetFont('Helvetica','',10);
  135.         $client->htmltable($single);
  136.         $client->output('','I');
  137.     }
  138.     if($_GET['query'] == "view-allocation")
  139.     {
  140.         require('script_pdftable.php');
  141.         class PDF extends PDFTable
  142.         {
  143.             // Page Header
  144.             function Header()
  145.             {
  146.                 parent::Header();
  147.                 // Display the Logo.
  148.                 $this->Image('../img/logo_medium.jpg',10,8,80);
  149.                 // Set the Font.
  150.                 $this->SetFont('Helvetica','B','24');
  151.                 // Display the Page Title.
  152.                 $this->Cell(0,5,'LEAD SHEET',0,1,'R');
  153.                 // Reset the Font.
  154.                 $this->SetFont('Helvetica','',10);
  155.                 // Line Break to Space
  156.                 $this->Ln(10);
  157.             }
  158.         }
  159.         $client = new PDF();
  160.         $client->AddPage();
  161.         $client->SetFont('Helvetica','',10);
  162.         $client->htmltable($multi,$numrows);
  163.         $client->output('','I');
  164.     }
  165. }
  166.  
  167. #####################################################################################################
  168.  
  169.  
  170. connect ();
  171.  
  172. chooseQuery();
  173.  
  174. choosePDF();
  175.  
  176.  
  177.  
  178. ?>
  179.  
  180. <?php
  181.  
  182. ob_start();
  183.  
  184. $count=5;
  185. while (($count--)>0) echo "count is ".$count;
  186.  
  187. $stuff=ob_get_clean();
  188.  
  189. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement