Esempio n. 1
0
function dumptable($tablenm)
{
    echo "<h1>{$tablenm}</h1>\n";
    $sql = "SELECT * from {$tablenm}";
    dispsql($sql);
    $res = mysql_query($sql) or die("Error during select. " . mysql_error());
    disphor($res);
}
Esempio n. 2
0
 public function loadByUserNm($usernm)
 {
     $sql = "SELECT usernm, userix, firstnm, lastnm, phonenbr, member, admin " . "  FROM user " . "  WHERE usernm = '{$usernm}'";
     dispsql($sql);
     $result = mysql_query($sql) or die("Error loading User for {$usernm}. " . mysql_error());
     $o = mysql_fetch_object($result, "User");
     $this->usernm = $o->usernm;
     $this->userix = $o->userix;
     $this->firstnm = $o->firstnm;
     $this->lastnm = $o->lastnm;
     $this->phonenbr = $o->phonenbr;
     $this->member = $o->member;
     $this->admin = $o->admin;
 }
Esempio n. 3
0
 public function logex($xacttype, $description = NULL, $userix = NULL, $orderix = NULL, $eventix = NULL, $detail = NULL)
 {
     global $debug;
     $this->xacttype = $xacttype;
     if ($description) {
         $this->description = $description;
     }
     if ($userix) {
         $this->userix = $userix;
     }
     if ($orderix) {
         $this->orderix = $orderix;
     }
     if ($eventix) {
         $this->eventix = $eventix;
     }
     if ($detail) {
         $this->detail = $detail;
     }
     $sql = "INSERT INTO xactlog SET " . "xacttype = '{$xacttype}', ";
     if ($description) {
         $sql .= "  description = '{$description}', ";
     }
     if ($userix) {
         $sql .= "  userix = {$userix}, ";
     }
     if ($orderix) {
         $sql .= "  orderix = {$orderix}, ";
     }
     if ($eventix) {
         $sql .= "  eventix = {$eventix}, ";
     }
     if ($detail) {
         $sql .= "  detail = '{$detail}', ";
     }
     $sql = substr($sql, 0, strlen($sql) - 2);
     if ($debug > 1) {
         dispsql($sql);
     }
     $result = mysql_query($sql) or die("Error logging to xactlog. " . mysql_error());
     $this->xactix = mysql_insert_id();
     $this->xacttime = dbgetsingleton("SELECT xacttime FROM xactlog WHERE xactix = {$this->xactix}", "xacttime");
     if ($debug > 1) {
         echo "<pre>";
         print_r($this);
         echo "</pre>\n";
     }
 }
Esempio n. 4
0
 public function save()
 {
     $ER_DUP_ENTRY = 1062;
     $sql = "INSERT INTO orderdtl SET " . "  orderix = {$this->orderix}, " . "  orderdtlix = {$this->orderdtlix}, " . "  itemix = {$this->itemix}, " . "  eventix = {$this->eventix}, " . "  action = '{$this->action}', " . "  qty = {$this->qty}, " . "  extamt = {$this->extamt}";
     dispsql($sql);
     $result = mysql_query($sql);
     $errno = mysql_errno();
     if ($errno == $ER_DUP_ENTRY) {
         $sql = "UPDATE orderdtl SET " . "    orderix = {$this->orderix}, " . "    orderdtlix = {$this->orderdtlix}, " . "    itemix = {$this->itemix}, " . "    eventix = {$this->eventix}, " . "    action = '{$this->action}', " . "    qty = {$this->qty}, " . "    extamt = {$this->extamt} " . "  WHERE orderix = {$this->orderix} AND " . "    orderdtlix = {$this->orderdtlix}";
         dispsql($sql);
         $result = mysql_query($sql) or die("Error updating OrderDtl for orderix {$this->orderix}, orderdtlix {$this->orderdtlix}. " . mysql_error());
     } else {
         die("{$errno}: Error inserting OrderDtl for orderix {$this->orderix}, " . "orderdtlix {$this->orderdtlix}. " . mysql_error());
     }
     return mysql_affected_rows();
 }
Esempio n. 5
0
 public function save()
 {
     if (!$this->userix) {
         $sql = "INSERT INTO user SET " . "    usernm = '{$this->usernm}', " . "    passwd = PASSWORD('{$this->passwd}'), " . "    firstnm = '{$this->firstnm}', " . "    lastnm = '{$this->lastnm}', " . "    phonenbr = '{$this->phonenbr}', " . "    member = '{$this->member}'";
         if (1) {
             dispsql($sql);
         }
         $result = mysql_query($sql) or die("Error inserting user {$this->usernm}. " . mysql_error());
         $this->userix = mysql_insert_id();
     } else {
         $sql = "UPDATE user SET " . "    usernm = '{$this->usernm}', " . "    firstnm = '{$this->firstnm}', " . "    lastnm = '{$this->lastnm}', " . "    phonenbr = '{$this->phonenbr}', " . "    member = '{$this->member}' " . "  WHERE userix = {$this->userix}";
         if (1) {
             dispsql($sql);
         }
         $result = mysql_query($sql) or die("Error updating user {$this->usernm}. " . mysql_error());
     }
 }
Esempio n. 6
0
    (SELECT COUNT(*) FROM registration r 
      WHERE r.waiting 
        AND r.eventix = e.eventix) 
    AS waiting,
    (SELECT COUNT(*) FROM registration r 
      WHERE r.waiting 
        AND r.eventix = e.eventix 
\t\tAND r.userix = {$userix})
    AS mywaiting
  FROM event e
  {$whereClause}
  GROUP BY e.eventdt, e.advstarttm, e.eventcd
  ORDER BY e.eventdt, e.advstarttm, e.eventcd
EOQ;
if ($debug > 1) {
    dispsql($sql);
}
$res = mysql_query($sql) or die("Error during event select. " . mysql_error());
echo "<form action='eventorder.php' method='post'>\n";
if ($userix) {
    echo "<input type='submit' name='action' value='Submit Order'>\n";
}
$ix = 0;
$preveventcdpfx = '';
while ($row = mysql_fetch_object($res)) {
    $openings = max($row->capacity - $row->reserved, 0);
    /* Get personal reservation counts */
    if ($usernm) {
        $myreserved = dbgetsingleton("SELECT COUNT(*) myreserved " . "  FROM registration " . "  WHERE eventix = {$row->eventix} " . "    AND NOT waiting " . "    AND userix = {$userix} " . "    AND releasetime IS NULL", "myreserved");
        $myreleased = dbgetsingleton("SELECT COUNT(*) myreleased " . "  FROM registration " . "  WHERE eventix = {$row->eventix} " . "    AND NOT waiting " . "    AND userix = {$userix} " . "    AND releasetime IS NOT NULL", "myreleased");
        if ($row->waiting) {
Esempio n. 7
0
 public function setPmtRejTime()
 {
     $sql = "UPDATE orderhdr SET \n" . "  pmtrejtime = CURRENT_TIMESTAMP \n" . "  WHERE orderix = {$this->orderix}";
     dispsql($sql);
     $result = mysql_query($sql) or die("Error updating Order payment rejection timestamp. " . mysql_error());
     $this->pmtrejtime = dbgetsingleton("SELECT pmtrejtime FROM orderhdr WHERE orderix = {$this->orderix}", "pmtrejtime");
     return $this->pmtrejtime;
 }