Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2014
    Posts
    44

    Unanswered: Embedding Progress bar in a table

    Hi folks,

    I want to embed the progress bar inside each element in the table.
    Please help me with this matter,

    Thanks,
    Chris

    So far I have this

    PHP Code:
     require_once './dbinfo.inc.php';
     
    session_start();
     
      if(!isset(
    $_SESSION['username'])){
           echo <<< EOD
           <h1>You are UNAUTHORIZED !</h1>
           <p>INVALID usernames/passwords<p>
           <p><a href="login.php">LOGIN PAGE</a><p>
    EOD;
           exit;
      }
      
      function 
    progressBar($percentage) {
        
    $data "<div id=\"progress-bar\" class=\"all-rounded\">\n";
        
    $data .= "<div id=\"progress-bar-percentage\" class=\"all-rounded\" style=\"width: $percentage%\">";
            if (
    $percentage 5) { $data .= "$percentage%";} else {$data .= "<div class=\"spacer\"> </div>";}
        
    $data .= "</div></div>";
        return 
    $data;
        }
      
      
    // GENERATE THE APPLICATION PAGE
       
    $conn oci_pconnect(ORA_CON_UNORA_CON_PWORA_CON_DB);
       
       
    // 1. SET THE CLIENT IDENTIFIER AFTER EVERY CALL
       // 2. USING UNIQUE VALUE FOR BACK END USER
       
    oci_set_client_identifier($conn$_SESSION['username']);
       
       
    //$username = htmlentities($_SESSION['username'], ENT_QUOTES);
       
       
    $fab_query 'SELECT * FROM FABRICATION';
       
    $fab_parse oci_parse ($conn$fab_query);  
       
    oci_execute($fab_parseOCI_DEFAULT);
       
        echo 
    "<table border='1'>\n";
        
    $ncols oci_num_fields($fab_parse);
        echo 
    "<tr>\n";
        for (
    $i 1$i <= $ncols; ++$i) {
        
    // COLUMN RECURRENCE
        
    $colname oci_field_name($fab_parse$i);
        echo 
    "  <th><b>".htmlentities($colnameENT_QUOTES)."</b></th>\n";
    }
    echo 
    "</tr>\n";

    while ((
    $row oci_fetch_array($fab_parseOCI_ASSOC+OCI_RETURN_NULLS)) != false
    {
         echo 
    "<tr>\n";
         foreach (
    $row as $item
         {        
              
    //echo "  <td>".($item !== null ? htmlentities($item, ENT_QUOTES):" ")."    RECURRENCE HERE</td>\n";
              
    echo "  <td>".($item);
         }
        echo 
    "</tr>\n";
    }
    echo 
    "</table>\n";
    ?> 

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Basic idea:
    PHP Code:
         echo "<tr>\n"
         foreach (
    $row as $item)  
         {
              echo 
    "  <td>".($item)."</td><td>".progressBar($item["progress"])."</td>";
         } 
        echo 
    "</tr>\n"
    Let us know how you get on
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2014
    Posts
    44
    I can get the progress bar to work. but I need two different values for them to work. I need to compare each element's amount with the "QTY" column in "MASTER_DRAWING" Table.

    So how do i compare the values to make the progress bar work. Thanks

    PHP Code:
    while (($row oci_fetch_array($fab_parseOCI_ASSOC+OCI_RETURN_NULLS)) != false
    {
         echo 
    "<tr>\n";
         foreach (
    $row as $item
         {        
              
              
    //echo "  <td>".($item !== null ? htmlentities($item, ENT_QUOTES):" ")."    ITEM RECURRENCE HERE</td>\n";
              
    echo "  <td>".($item);
              if (
    is_numeric($item)){
                  echo 
    '/ <meter value=10 min="2" max="10"></meter>';
              } else {
                  echo 
    ' ';
              }
         }
        echo 
    "</tr>\n";
    }
    echo 
    "</table>\n"

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    PHP Code:
    ...progressBar($item["amount"] / $item["quantity"])... 
    ?
    George
    Home | Blog

  5. #5
    Join Date
    Mar 2014
    Posts
    44
    I can get the idea but im stuck with the comparing values that i pulled from database and executing the implementation.

    I attached my db structure in this posting

    PHP Code:
    // GENERATE THE APPLICATION PAGE
       
    $conn oci_pconnect(ORA_CON_UNORA_CON_PWORA_CON_DB);
       
       
    // 1. SET THE CLIENT IDENTIFIER AFTER EVERY CALL
       // 2. USING UNIQUE VALUE FOR BACK END USER
       
    oci_set_client_identifier($conn$_SESSION['username']);
       
       
    //$username = htmlentities($_SESSION['username'], ENT_QUOTES);
       
       
    $fab_query 'SELECT REV_DATE, HEAD_MARK, QTY, CUTTING, ASSEMBLY,
           WELDING, DRILLING, FINISHING FROM MASTER_DRAWING'
    ;
       
    $fab_parse oci_parse ($conn$fab_query);  
       
    oci_execute($fab_parseOCI_DEFAULT);
       
       
    $qty_query 'select master_drawing.qty from master_drawing';
       
    $qty_parse oci_parse($conn$qty_query);
       
    oci_execute($qty_parseOCI_DEFAULT);
       
        echo 
    "<table border='1'>\n";
        
    $ncols oci_num_fields($fab_parse);
        echo 
    "<tr>\n";
        for (
    $i 1$i <= $ncols; ++$i) {
        
    // COLUMN RECURRENCE
        
    $colname oci_field_name($fab_parse$i);
        echo 
    "  <th><b>".htmlentities($colnameENT_QUOTES)."</b></th>\n";
    }
    echo 
    "</tr>\n";

    while ((
    $row oci_fetch_array($fab_parseOCI_ASSOC+OCI_RETURN_NULLS)) != false
    {    
         
    $temp_qty oci_fetch_array($fab_parseOCI_ASSOC+OCI_RETURN_NULLS);
         echo 
    "<tr>\n";
         foreach (
    $row as $item
         {        
              
              
    //echo "  <td>".($item !== null ? htmlentities($item, ENT_QUOTES):" ")."    ITEM RECURRENCE HERE</td>\n";
              
    echo "  <td>".($item);
              if (
    is_numeric($item)){
                  
    //echo '/ <meter value=$item min="0" max=>temp_qty</meter>';
                  
    echo ''.  progressBar($item $temp_qty);
              } else {
                  echo 
    ' ';
              }
         }
        echo 
    "</tr>\n";
    }
    echo 
    "</table>\n";
    ?> 
    Attached Thumbnails Attached Thumbnails dbsample.jpg  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •