Welcome Guest, Not a member yet? Register   Sign In
Database trouble - Error Number: 1096
#9

[eluser]xwero[/eluser]
[quote author="coldKingdom" date="1204059792"]
Gallery.php - Model

Code:
<?php
class Gallery extends Model {

    function Gallery()
    {
        // Call the Model constructor
        parent::Model();
    }
    
    function get_last_ten_entries()
    {
        $this->db->select("gallery_picture");
        $this->db->from('tbl_gallery');
        
        $total = $this->db->count_all_results(); //Without this it works perfectly
        
        $query = $this->db->get();
        
        return $query->result();
    }
}
?>


Quote:An Error Was Encountered
Error Number: 1096

No tables used

SELECT *

I don't know really what more i can do to make it easier. I can test 1.5.4 and 1.6.0 if you wan't me to.[/quote]

Try this
Code:
function get_last_ten_entries()
    {
        $this->db->start_cache(); //added
        $this->db->select("gallery_picture");
        $this->db->from('tbl_gallery');
        $this->db->stop_cache(); // added
        $total = $this->db->count_all_results(); //Without this it works perfectly
        
        $query = $this->db->get();
        $this->db->flush_cache(); // added
        return $query->result();
    }
Those functions are added in 1.6.1 because the count_all_results method resets all the above sql statement building methods.


Messages In This Thread
Database trouble - Error Number: 1096 - by El Forum - 02-24-2008, 08:21 PM
Database trouble - Error Number: 1096 - by El Forum - 02-24-2008, 08:31 PM
Database trouble - Error Number: 1096 - by El Forum - 02-25-2008, 02:27 AM
Database trouble - Error Number: 1096 - by El Forum - 02-25-2008, 07:23 AM
Database trouble - Error Number: 1096 - by El Forum - 02-25-2008, 07:36 AM
Database trouble - Error Number: 1096 - by El Forum - 02-25-2008, 07:38 AM
Database trouble - Error Number: 1096 - by El Forum - 02-25-2008, 08:07 AM
Database trouble - Error Number: 1096 - by El Forum - 02-26-2008, 09:03 AM
Database trouble - Error Number: 1096 - by El Forum - 02-26-2008, 09:13 AM
Database trouble - Error Number: 1096 - by El Forum - 02-26-2008, 09:31 AM
Database trouble - Error Number: 1096 - by El Forum - 11-26-2008, 09:16 AM
Database trouble - Error Number: 1096 - by El Forum - 07-18-2010, 12:16 PM
Database trouble - Error Number: 1096 - by El Forum - 07-18-2010, 12:24 PM
Database trouble - Error Number: 1096 - by El Forum - 07-19-2010, 10:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB