CodeIgniter Forums
Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... (/showthread.php?tid=17848)

Pages: 1 2 3 4 5


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-17-2009

[eluser]Bob Puzld[/eluser]
Research Assistant,

I have this code in the php file...

echo "<pre>";
var_dump ($payouts->result_array());
echo "</pre>";

This is how I am now getting this output...

array(0) {
}


Is this what you are referring to?


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-17-2009

[eluser]Bob Puzld[/eluser]
Grad Student,

I tried entering that code but I get an error. I presume I have to modify below code with database name or query name? Sorry, not an expert in php code...

$this->db->last_query()


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-17-2009

[eluser]jedd[/eluser]
Please - embrace the power of [ code] tags.


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-17-2009

[eluser]sophistry[/eluser]
the more code you post the better. when you put it in code block tags it ensures that everyone can read it.
Code:
echo “”;
  var_dump ($payouts->result_array());
  echo “</pre>”;

this section does not appear in any code you have posted so far.

please start at the beginning with the controller filename and the controller code. post as much as you can.

now to your issue:
the array is showing zero items. that is good. that means the call is working (maybe, CI 1.3 no longer "exists" per se, so only a CI archeologist could tell us what is returned by default).

so, are you able to get any calls to the database to work? that is, do any o your pages work and show data like they are supposed to?

if so, please post the code that is working alongside the code that isn't working.

more info = better feedback especially with OLD CI installs which are almost 3 years old.

EDIT: also, please change the title of this thread to something like: "Old CI install, recently upgraded PHP and MySQL, and one query doesn't work"

that would help a lot.


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[eluser]Bob Puzld[/eluser]
I don't see any way to change the title of the post...


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[eluser]sophistry[/eluser]
when you click the EDIT button under any post, you can change the title too.


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[eluser]Bob Puzld[/eluser]
I changed it. Thanks.


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[eluser]sophistry[/eluser]
annnnnd... have you tried any of the debugging steps mentioned?


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[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...


Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - El Forum - 04-20-2009

[eluser]sophistry[/eluser]
please do me a favor and just tell us if all of your other queries are working.

and please, in your future posts, if i may be so bold as to criticize; do pay attention to the questions i am typing. i don't get paid for this and it's pretty annoying for you to keep ignoring questions i spend time thinking up... :-(

cheers.