CodeIgniter Forums
Do I need to upgrade my version of CodeIgniter? - 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: Do I need to upgrade my version of CodeIgniter? (/showthread.php?tid=17034)

Pages: 1 2 3 4


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-27-2009

[eluser]Bob Puzld[/eluser]
Do you have some simple code for this that I can try quick?


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-27-2009

[eluser]jedd[/eluser]
In the code you've already posted, well, I've inserted it into the top bit there:

Code:
<h1>Payments Requested (&lt;?=$payouts->num_rows()?&gt;)</h1>
&lt;?php
    echo "<pre>";
    echo var_dump ($payouts);
    echo "</pre>";
?&gt;
&lt;? if($payouts->num_rows() != 0): ?&gt;



Do I need to upgrade my version of CodeIgniter? - El Forum - 03-27-2009

[eluser]Bob Puzld[/eluser]
Ok. I inserted the code. Here is what it spits out on the page now. Everything between "Payments Requested (0)" and "No pending payouts" is new.


Payments Requested (0)

object(CI_DB_mysql_result)#17 (6) {
["conn_id"]=>
resource(33) of type (mysql link)
["result_id"]=>
resource(59) of type (mysql result)
["db_debug"]=>
bool(true)
["result_array"]=>
array(0) {
}
["result_object"]=>
array(0) {
}
["current_row"]=>
int(0)
}

No pending payouts.


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-27-2009

[eluser]TheFuzzy0ne[/eluser]
You need to var_dump the the result_array or result_object, not the result object.

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;



Do I need to upgrade my version of CodeIgniter? - El Forum - 03-29-2009

[eluser]Bob Puzld[/eluser]
How do I do that? I guess I am not sure what you want me to do...


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-29-2009

[eluser]TheFuzzy0ne[/eluser]
You're doing this:
Code:
echo var_dump ($payouts);

You need to do this instead:
Code:
var_dump ($payouts->result_array());



Do I need to upgrade my version of CodeIgniter? - El Forum - 03-30-2009

[eluser]Bob Puzld[/eluser]
Thanks. This is what I get now...


Payments Requested (0)

array(0) {
}

No pending payouts.


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-30-2009

[eluser]TheFuzzy0ne[/eluser]
Then the problem is your SQL query.

It would help if we could see your table schema and some example data.


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-30-2009

[eluser]Bob Puzld[/eluser]
SQL QUERY... SELECT * FROM `payouts` WHERE 1


'Payouts' TABLE SCHEMA (Fields)...

id: int(10), UNSIGNED, No-Null, auto_increment
user_id: int(10), UNSIGNED, No-Null, default=0
organization_id: int(10), UNSIGNED, No-Null, default=0
date_requested: date, No-Null, default=0000-00-00
date_paid: date, No-Null, default=0000-00-00
amount: double, No-Null, default=0

**Collation blank for all fields



'Payouts' EXAMPLE DATA (2 records)...

1. id=1304, user_id=102, organization_id=0, date_requested=2009-03-29, date_paid=0000-00-00, amount=19.44

2. id=1305, user_id=372, organization_id=0, date_requested=2009-03-29, date_paid=0000-00-00, amount=48.8


Do I need to upgrade my version of CodeIgniter? - El Forum - 03-30-2009

[eluser]TheFuzzy0ne[/eluser]
That's not possible. Please repost your controller method, and your model method (in code tags).

Logic dictates that if there is data in the table and you are using the query you say you are using, you should get every row back in your result. The fact you are not tells me something isn't right.

Also, I'm a bit confused. You're query queries a table name with all lowercase letters, but your table schema has the table name starting with an uppercase character. Is that just a typo?