db stuff

is it mandatory to create a function first on the controller before
being allowed to execute an insert or any db stuff queries? :question:
I loaded the $this->load->database() from the constructor and then at the bottom I did these,
$data = array(
                'url'=> 'www.mynewclient.com',
                'name' => 'bigco inc',
                'id' => '33',

when I ran the page, I received a T_Function error.
then when I wrapped those query inside a function and it worked :gulp:

[eluser]Jamie Rumbelow[/eluser]
A T_FUNCTION error is a syntax error - are you sure your syntax is correct?

You should be able to directly query out of a controller function, but by the Model-View-Controller convention you should put any data-related functionality in the Model.


You should create a function on the controller first (such as index) so CI knows what to display by default.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.