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

[eluser]Bob Puzld[/eluser]
Hi, I am reposting this because I still have no answers. I am new to codeigniter and am trying to help a friend figure out his web site. His site was originally built with Codeigniter version 1.3. The server was recently upgraded from PHP Version 4.32 to 5.2.6, and MySql from version 3.23 to 5.0.67. Now one of his pages does not display the proper results. The table in the database has many recent entries of people requesting payment, but the page displays… No pending payouts. The code from this page is below. Additional info to follow. Any help would be appreciated. Thanks.

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

&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.’
‘.$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;” >
&lt;input type=“submit” value=“Pay Requests” /&gt;&lt;/p>
&lt;?=form_close()?&gt;
&lt;? else: ?&gt;
No pending payouts.
&lt;? endif; ?&gt;
#2

[eluser]Bob Puzld[/eluser]
Also, I did a var_dump on the Payment Requests page and this is what it shows.

array(0) {
}
#3

[eluser]sophistry[/eluser]
turn on error reporting.

also, if you post more code, please use code blocks - raw code give me headache.
#4

[eluser]Bob Puzld[/eluser]
Does error reporting have to be turned on, on the server?
#5

[eluser]sophistry[/eluser]
to be able to see if you are actually working with the CI database query object...num_rows() method needs a valid query object. if error reporting is off you won't get the error.
#6

[eluser]Bob Puzld[/eluser]
Ok. So, error reporting is turned on, on the server end right?
#7

[eluser]sophistry[/eluser]
see any errors?
#8

[eluser]Bob Puzld[/eluser]
No errors, just array(0) { }
#9

[eluser]sophistry[/eluser]
var dump $payouts->result() and see what you get
#10

[eluser]elvix[/eluser]
You could also take a look at the query itself, probably located in the controller, and echo out a $this->db->last_query() right after it to see what's being sent to the DB.




Theme © iAndrew 2016 - Forum software by © MyBB