Welcome Guest, Not a member yet? Register   Sign In
Old CI install, server updates...
#1

[eluser]Bob Puzld[/eluser]
Hi, I am new to codeigniter and am a novice to PHP, and at the same time trying to help a friend figure out his web site. His site was originally built with Codeigniter version 1.3, which as you know is very old. 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. Any help would be appreciated. Thanks.
#2

[eluser]TheFuzzy0ne[/eluser]
If I remember correctly, it's due to the database class. I'd recommend you check your model methods are passing back the data you expect.
#3

[eluser]Bob Puzld[/eluser]
I will check it out. Thanks.
#4

[eluser]Bob Puzld[/eluser]
Do you see anything wrong with the code below? This is from the model file...


Code:
function GetPaymentRequests() {
    $this->db->select('users.*, payouts.amount, payouts.id as payout_id');
    $this->db->from('payouts');
    $this->db->join('users','payouts.user_id = users.id','INNER');
    $this->db->where('date_paid','0');
    $this->db->where('organization_id',0);
    $this->db->orderby('date_requested ASC');
    return $this->db->get();
  }
#5

[eluser]TheFuzzy0ne[/eluser]
Well that depends on the error you're getting. Perhaps passing FALSE as a second parameter to the select method might help? I'm just guessing.

orderby() has been deprecated in favour of order_by(). It sorts by ASC implicitly, but otherwise seems to expect 'ASC' or 'DESC' as the second parameter. I don't think the syntax you've used should be a problem, but I can't be sure. The _protect_identifiers method too confusing to figure out in the frame of mind I am in.
#6

[eluser]Bob Puzld[/eluser]
I am not getting a specific error. I just don't get any results. In other words, the page is displaying no payments requested, even though users have requested payment from their account. As a work around, we are scanning the hundreds of accounts, individually to see if someone has requested payment.

When I do a var_dump on this page, I get this displayed on my page...

Code:
array(0) {
}


Also, I tried removing ASC, but it doesn't change the results.
#7

[eluser]OES[/eluser]
It wouldn't be an array but an object you are returning.

Maybe try this.

Code:
function GetPaymentRequests() {
    $this->db->select('users.*, payouts.amount, payouts.id as payout_id');
    $this->db->from('payouts');
    $this->db->join('users','payouts.user_id = users.id','INNER');
    $this->db->where('date_paid','0');
    $this->db->where('organization_id',0);
    $this->db->orderby('date_requested ASC');
    $query = $this->db->get();
    return $query->result_array();
  }

[OES]
#8

[eluser]Bob Puzld[/eluser]
I tried that and this is the result now...

Payments Requested (
Fatal error: Call to a member function num_rows() on a non-object in /home/rrrprogr/public_html/system/application/views/users/payment_requests.php on line 1
#9

[eluser]OES[/eluser]
By returning result_array() its returning the array not an object.

So you would do a normal count of an array ($result = count($a)Wink

By changing to the return array no doubt you will have to change your view.

$data = $this->model->GetPaymentRequests();

$result = count($data);
foreach($data as $d){
$data['item']; // etc
}

hope that makes sense.
#10

[eluser]Bob Puzld[/eluser]
Not sure I exactly understand what you are saying. Sorry. I am a novice. I am beginning to understand how codeigniter operates with the models and controllers and so forth. Can you simplify for me (in codeigniter for dummies terminology)? :-)




Theme © iAndrew 2016 - Forum software by © MyBB