This particular application has been in use for over a year now, and uses several dozen models, and I am having trouble only with this one particular new function.
public function get_slides($promo = NULL) {
$sql = "SELECT description as alt, image, link
FROM " . CONFIG_DATABASE . ".slides
WHERE active = '1' AND acct_no = '" . API_ACCT . "' ORDER BY priority ASC;";
$query = $this->db->query($sql);
var_dump($sql);
var_dump($query);
return $query->result_array();
}
The results of this are:
string 'SELECT description as alt, image, link
FROM web_config_development.slides
WHERE active = '1' AND acct_no = '10001' ORDER BY priority ASC;' (length=143)
boolean false
Followed by:
Fatal error: Call to a member function result_array() on a non-object
The query works fine in MySQL Workbench. In my searching for this issue I have come across docs referring to true/false responses on INSERT and DELETE, but not on SELECT.
This does not make any sense ... if you have any ideas, sharing them would be greatly appreciated.
if used result_array() then first will be checked number of rows in query
if($query->num_rows()>0){
return $query->result_array();
}else {
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With