Welcome Guest, Not a member yet? Register   Sign In
Data Mapper hasn't found table
#1

[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
#2

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

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB