Welcome Guest, Not a member yet? Register   Sign In
View providing no results, but table has recent entries
#41

[eluser]Chad Fulton[/eluser]
I think Jedd is right that putting your DB Schema and files up somewhere so we can duplicate the problem is probably best, otherwise it's just like playing whack-a-mole.

However, in the spirit of playing Whack-a-mole some more until you get those files uploaded:

1. I'm concerned about this line, from your model:
Code:
$this->db->where('date_paid','0');
Why is the 0 in quotes? Is that intended? I'm wondering if MySQL 3.23 had some equality functionality, like '0' = 0, or '0' = NULL, or something (I don't have a MySQL 3.23 to test on, unfortunately) that got removed in 5+. What column type is the date_paid? What are some of the possible values it might have?

2. I'm wondering about your INNER JOIN. Inner joins only select data if there are corresponding rows in both tables, so is it possible that there is a disconnect between the users table and the payouts table that you haven't noticed (like the user_id field is storing the ids incorrectly)?

Other than that, Jedd's suggestion is best, because:
a) The var_dump($this->db->_error_message()); connects directly to the MySQL instance, so if there was an error message, it would show it. The fact that it's an empty string means that the query is NOT creating a MySQL error.
b) Since it's not creating an error, it means (as far as I can tell) that your query is just plain not returning any results. That means either your JOIN clause or one of your WHERE clauses is causing the problems.
c) Without your DB Schema structure and sample data, it's hard to pinpoint the problem.

Here's something else you could do, pro-tem:
In your controller, add these lines:
Code:
$query = $this->db->query('SHOW COLUMNS from users');
echo '<br />User Column Dump:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SELECT * FROM users ORDER BY RAND() LIMIT 1');
echo '<br />Sample User Data:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SHOW COLUMNS from payouts');
echo '<br />Payouts Column Dump:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SELECT * FROM payouts ORDER BY RAND() LIMIT 1');
echo '<br />Sample Payout Data:'.'<br />';
var_dump($query->result_array());

and let us know what that shows.
#42

[eluser]Bob Puzld[/eluser]
Thanks Chad and Jedd. I will try those couple of items that Chad suggested first, then if nothing I will go your route Jedd and pass along that info. I will try to get this done this weekend...

-Bob
#43

[eluser]Bob Puzld[/eluser]
[quote author="Chad Fulton" date="1256345418"]I think Jedd is right that putting your DB Schema and files up somewhere so we can duplicate the problem is probably best, otherwise it's just like playing whack-a-mole.

However, in the spirit of playing Whack-a-mole some more until you get those files uploaded:

1. I'm concerned about this line, from your model:
Code:
$this->db->where('date_paid','0');
Why is the 0 in quotes? Is that intended? I'm wondering if MySQL 3.23 had some equality functionality, like '0' = 0, or '0' = NULL, or something (I don't have a MySQL 3.23 to test on, unfortunately) that got removed in 5+. What column type is the date_paid? What are some of the possible values it might have?

2. I'm wondering about your INNER JOIN. Inner joins only select data if there are corresponding rows in both tables, so is it possible that there is a disconnect between the users table and the payouts table that you haven't noticed (like the user_id field is storing the ids incorrectly)?

Other than that, Jedd's suggestion is best, because:
a) The var_dump($this->db->_error_message()); connects directly to the MySQL instance, so if there was an error message, it would show it. The fact that it's an empty string means that the query is NOT creating a MySQL error.
b) Since it's not creating an error, it means (as far as I can tell) that your query is just plain not returning any results. That means either your JOIN clause or one of your WHERE clauses is causing the problems.
c) Without your DB Schema structure and sample data, it's hard to pinpoint the problem.

Here's something else you could do, pro-tem:
In your controller, add these lines:
Code:
$query = $this->db->query('SHOW COLUMNS from users');
echo '<br />User Column Dump:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SELECT * FROM users ORDER BY RAND() LIMIT 1');
echo '<br />Sample User Data:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SHOW COLUMNS from payouts');
echo '<br />Payouts Column Dump:'.'<br />';
var_dump($query->result_array());
$query = $this->db->query('SELECT * FROM payouts ORDER BY RAND() LIMIT 1');
echo '<br />Sample Payout Data:'.'<br />';
var_dump($query->result_array());

and let us know what that shows.[/quote]


Chad, you finally nailed my problem. I took the quote from the zero (as below) and now I finally get the results that we were looking for. I did this same thing before the updates but it didn't affect it. So, I guess the combination of the updates and your suggestion did it. Thanks again. If I have additional problems I will create a new post. If you happen to read this Jedd, thanks for your assistance as well.

Code:
$this->db->where('date_paid',0);


-Bob




Theme © iAndrew 2016 - Forum software by © MyBB