Jump to content

How can I create admin tabs?


Recommended Posts

Thx Paul. It works.
But now going in to the code... How does the "__construct()" function work?. I'm a bit confused trying to get some values from my DB.
Is "$this->table = 'xxxxxx'" this the database table name or what?. Where do I put the DB table name of the query? (FROM).

Link to comment
Share on other sites

The tables are encapsulated by objects though, so unless you're creating new tables in the database you shouldn't normally be worried about the $this->table property. If you want to create a new table, then you would create a class for it (e.g. the Supplier class in /classes/Supplier.php).

If you need data from tables, then you would use the member functions of an object of the correct class. In the example of getting supplier data, you would instantiate a supplier object :

$mysupplier = new Supplier();



The you can use any of the member functions in the supplier class to obtain data from the database.

You can also just execute queries directly on the database, using the Db class:

$query = 'SELECT * FROM '._DB_PREFIX_.'supplier;';
$result = Db::getInstance()->ExecuteS($query);



Note that if you make changes to the database using the second example, then you'd be bypassed the application logic, and your database may no longer be consistent.
[/code]

Hope this helps!

Paul

Link to comment
Share on other sites

×
×
  • Create New...