CodeIgniter Forums
Data Mapper hasn't found table - 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: Data Mapper hasn't found table (/showthread.php?tid=32159)



Data Mapper hasn't found table - El Forum - 07-14-2010

[eluser]Unknown[/eluser]
Hello mates,

I'm starting to use data mapper 1.7.1 with CI 1.7.2, but when I try to do a simple query like bellow:

Code:
// MODEL
class Table extends DataMapper
{
    public $table = 'tables';
    
    function __construct()
    {
        parent::DataMapper();
    }
    
}
// CONTROLLER
class test extends Controller
{
    function __construct()
    {
        parent::Controller();        
    
    }
    
    
    function index()
    {

        $t = new Table();
        $x = $t->get();
            foreach ($x->all as $b)
        {
        echo $b . '<br>';    
        }
        
    }
    
}
the following error is returned:

A Database Error Occurred

Error Number: 1096

No tables used

SELECT *

Somebody help me, please!!!!

Thanks, in advance


Data Mapper hasn't found table - El Forum - 07-14-2010

[eluser]Atas[/eluser]
Try change the name of table "tables" to another word.


Data Mapper hasn't found table - El Forum - 07-15-2010

[eluser]Unknown[/eluser]
Hello Atas,
I changed the table name to 'tabelas',but the error continues


Data Mapper hasn't found table - El Forum - 08-24-2010

[eluser]gserrano[/eluser]
Hi, $table is reserved variable.

http://stensi.com/datamapper/pages/reservednames.html