Welcome Guest, Not a member yet? Register   Sign In
Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work...
#19

[eluser]Bob Puzld[/eluser]
Ok. Here is the code from the page that is not functioning properly...

Code:
<h1>Payments Requested (&lt;?=$payouts->num_rows()?&gt;)</h1>

&lt;?php
    echo "<pre>";
    var_dump ($payouts->result_array());
    echo "</pre>";
?&gt;

&lt;? if($payouts->num_rows() != 0): ?&gt;
  &lt;?=form_open('users/payment_requests_process')?&gt;
  <table id="report" cellspacing="0">
  <tr><th>Account Number</th><th>Name</th><th>Address</th><th>Balance</th><th>Amount Requested</th></tr>
  &lt;? $i = 1;
     foreach($payouts->result() as $row): ?&gt;
    <tr &lt;?= alternator('',' class="altrow"') ?&gt;>
      <td>&lt;?=$row->id?&gt;&lt;input type="hidden" name="payout&lt;?=$i?&gt;" value="&lt;?=$row-&gt;payout_id?&gt;" /></td>
      <td>&lt;?=$row->fname.' '.$row->lname?&gt;</td>
      <td>&lt;?= $row->address.'<br />'.$row->city.', '.$row->state.' '.$row->zip?&gt;</td>
      <td>&lt;?=$row->balance?&gt;</td>
      <td>&lt;?=$row->amount?&gt;</td>
    </tr>
  &lt;? ++$i;
     endforeach; ?&gt;
  </table>
  &lt;input type="hidden" name="num_payouts" value="&lt;?= $payouts-&gt;num_rows() ?&gt;" />
  <p>&lt;input type="submit" value="Pay Requests" /&gt;&lt;/p>
  &lt;?=form_close()?&gt;
&lt;? else: ?&gt;
  No pending payouts.
&lt;? endif; ?&gt;

Here is the code from the page that is functioning properly...

Code:
&lt;style type="text/css"&gt;
/*&lt;![CDATA[*/
.total {
  background-color: #FFFF99;
  border: 1px solid #FFFF33;
}

.number {
  background-color: #FFFF99;
  font-size: 20px;
}

.datatable {
  width: 100%;
  border: 1px solid #000000;
  border-collapse: collapse;
}

.datatable td, .datatable th {
  border: 1px solid #999999;
  padding: 3px;
}

.datatable td.title {
  background-color: #999999;
  font-weight: bold;
  /*padding: 3px;*/
  font-size: 14px;
}

.datatable th {
  font-weight: bold;
  text-align: left;
  color: #000000;
  background-color: #F0F0F0;
}

#booster_total {
  background-color: #000000;
  color: #FFFFFF;
  text-align: center;
  padding: 5px;
}
/*]]>*/
&lt;/style&gt;

<div id="booster_total">&lt;?=$booster_total?&gt;</div>

<h1>Account Status</h1>

<p><span class="number">Balance: $ &lt;?= number_format($aUser->balance, 2, '.', ''); ?&gt;</span>
&lt;? if($aUser->balance >= $this->config->item('MIN_PAYOUT_AMT')): ?&gt;
  <a >config->item('base_url')?&gt;users/payout_req/&lt;?= $aUser->id ?&gt;/&lt;?= $aUser->district_id ?&gt;">Request a Payout</a>
&lt;? endif; ?&gt;
</p>

<table width="100%" cellpadding="3" cellspacing="0">
  <tr><td width="20%"><strong>Account Number:</strong></td><td>&lt;?= $aUser->id; ?&gt;</td></tr>
  <tr><td><strong>Name:</strong></td><td>&lt;?= $aUser->fname. ' '.$aUser->lname; ?&gt;</td><td>&nbsp;</td><td><strong>Username:</strong></td><td>&lt;?= $aUser->username; ?&gt;</td></tr>
  <tr><td><strong>Address:</strong></td><td>&lt;?= $aUser->street.' '.$aUser->address.'<br />'.$aUser->city.', '.$aUser->state.' '.$aUser->zip; ?&gt;</td><td>&nbsp;</td><td><strong>Password:</strong></td><td>&lt;?= $aUser->password; ?&gt;</td></tr>
</table>

<p>&nbsp;</p>

<h1>Income</h1>
  <table class="datatable">
  <tr><th>Date</th><th>Number of Cans</th><th>Redemption Value</th><th>Total Account Value</th><th>Total Booster Contributions</th></tr>
  &lt;? if($collections->num_rows() != 0): ?&gt;
    &lt;? $account_total = 0;
       $booster_total = 0;

       foreach($collections->result() as $row):
       $account_total = ($row->num_cans*$this->config->item('AMT_PER_CAN')) + $account_total;
       $booster_total = ($row->num_cans*$this->config->item('BOOSTER_CONTRIB')) + $booster_total; ?&gt;
      <tr &lt;?= alternator('',' class="altrow"') ?&gt;>
        <td>&lt;?= date('m/d/Y',$row->date) ?&gt;</td>
        <td>&lt;?= $row->num_cans ?&gt;</td>
        <td>$ &lt;?= $row->num_cans*$this->config->item('AMT_PER_CAN') ?&gt;</td>
        <td>$ &lt;?= number_format($account_total, 2, '.', '') ?&gt;</td>
        <td>$ &lt;?= number_format($booster_total, 3, '.', '') ?&gt;</td>
      </tr>
    &lt;? endforeach; ?&gt;
  &lt;? else: ?&gt;
    <tr><td colspan="5">No cans have been collected yet.</td></tr>
  &lt;? endif; ?&gt;
  </table>


<h1>Payouts</h1>
  <table class="datatable">
  <tr><th>Status</th><th>Date Requested</th><th>Date Paid</th><th>Recipient</th><th>Amount</th></tr>
  &lt;? if($payouts->num_rows() != 0): ?&gt;
    &lt;? foreach($payouts->result() as $row):
       if($row->organization_id != 0) {
         $status = '-';
         $data_paid = '-';
       }
       elseif($row->date_paid == 0) {
         $status = '<strong style="color: #CC0000;">Pending</strong>';
         $date_paid = '-';
       }
       else {
         $status = '<strong style="color: #66CC33;">Paid</strong>';
         $date_paid = mysql_to_human($row->date_paid);
       }

       if($row->organization_id == 0)
         $recipient = $aUser->fname.' '.$aUser->lname;
       else {
         $this->db->select('name');
         $this->db->from('organization');
         $this->db->where('id',$row->organization_id);
         $query = $this->db->get();
         $org = $query->row();
         $recipient = $org->name;
       }?&gt;
      <tr &lt;?= alternator('',' class="altrow"') ?&gt;>
        <td>&lt;?= $status ?&gt;</td>
        <td>&lt;?= mysql_to_human($row->date_requested) ?&gt;</td>
        <td>&lt;?= $date_paid ?&gt;</td>
        <td>&lt;?= $recipient ?&gt;</td>
        <td>$ &lt;?= number_format($row->amount, 2, '.', '') ?&gt;</td>
      </tr>
    &lt;? endforeach; ?&gt;
  &lt;? else: ?&gt;
    <tr><td colspan="5">No payouts have been requested yet.</td></tr>
  &lt;? endif; ?&gt;
  </table>

Hope this helps...


Messages In This Thread
Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - by El Forum - 04-20-2009, 01:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB