예제 #1
0
function printObjectsTable()
{
    global $_pinkie;
    if (count($_pinkie->a_Objects) == 0) {
        echo '<tr>
              <td>No Objects attached to this Pinkie!</td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              </tr>';
        return;
    }
    foreach ($_pinkie->a_Objects as $_obj) {
        $_po = new PurchaseObject((int) $_pinkie->i_PinkieID);
        $_po->i_ObjectID = $_obj->i_ObjectID;
        $_po->fromDatabase();
        printf('<tr id="%d">
                      <td>%d</td>
                      <td>%s</td>
                      <td>%s</td>
                      <td>%s</td>
                      <td>%s</td>
                      <td>%.2f</td>
                      <td>%.2f</td>
                    </tr>', (int) $_po->i_ObjectID, (int) $_po->i_Quantity, $_po->s_StockNumber, $_po->s_Description, $_po->s_BC, $_po->s_AccountNumber, $_po->d_UnitPrice, (double) $_po->d_UnitPrice * (int) $_po->i_Quantity);
    }
}
예제 #2
0
<?php

include_once 'functions.php';
include_once 'PurchaseObject.php';
secureSessionStart();
if (strlen($_POST['objectID']) == 0) {
    // No Object ID was set, so this isn't a valid object.
    return;
}
$_o = new PurchaseObject((int) $_POST['pinkieID']);
$_o->i_ObjectID = (int) $_POST['objectID'];
$_o->fromDatabase();
echo json_encode($_o);
예제 #3
0
파일: pinkie.php 프로젝트: gogolB/pinkies2
 function getObjects()
 {
     // Everything is all good, load it from the database.
     // Connect to the database.
     $_db = getMysqli();
     // SQL query to run.
     $statement = $_db->prepare("SELECT ObjectID FROM Objects WHERE PinkieID=?");
     $statement->bind_param('i', $this->i_PinkieID);
     $statement->execute();
     // Error running the statment.
     if ($statement->errno != 0) {
         $_tmp = $statement->error;
         $statement->close();
         $_db->close();
         onError("Pinkie::getObjects()", 'There was an error running the query [' . $_tmp . '] Could not fetch Objects.');
     }
     $statement->store_result();
     if ($statement->num_rows == 0) {
         $statement->free_result();
         $statement->close();
         $_db->close();
         if (TRUE) {
             onError("Pinkie::getObjects()", 'Could not find any objects associated with the PID of: ' . $this->i_PinkieID);
         }
     }
     // We have a results.
     $statement->bind_result($_tempObjectID);
     while ($statement->fetch()) {
         $_o = new PurchaseObject($this->i_PinkieID);
         $_o->i_ObjectID = (int) $_tempObjectID;
         $_o->fromDatabase();
         array_push($this->a_Objects, $_o);
     }
     // Cleanup.
     $statement->free_result();
     $statement->close();
     $_db->close();
 }