Welcome Guest, Not a member yet? Register   Sign In
BackendPro 0.6.1

[eluser]aidanmcg33[/eluser]
Are there any examples of how to use the code for the models. Ive extended the base model but the guide doesnt tell you where to put the fetch command and if i have $this->insert('myinfo', $value); i get this error
Unknown column 'data' in 'field list'

INSERT INTO `styles` (`myinfo`) VALUES ('')

[eluser]adamp1[/eluser]
OK first of all, you don't need to implement the fetch method. This is already done for you. By extending the base model class you get a default set of methods.

By the look of things you are trying to run my Insert method. This requires 2 things.
- The table
- An array of columns => values

If you want examples of how to use the model try looking in the modules auth folder. There I have created models which work by extending the base method.

Does any of that help?

[eluser]aidanmcg33[/eluser]
not really.
the table has two fields. id and info. id is automatically generated by the database, i want to insert the info string into it.

[eluser]adamp1[/eluser]
ok so if your table is called style, and you have created a link in the $_TABLES variable at the top of Style => style, you would call the following.

Code:
$this->insert('Style',array('info'=>'some info stuff'));

[eluser]aidanmcg33[/eluser]
thank you that works Smile

[eluser]aidanmcg33[/eluser]
if i make the call to the model function. is there a simple call i can make to load the dashboard view again or do i need to set up the various sections again?

[eluser]adamp1[/eluser]
I don't quite get you, are you trying to create a dashboard widget? What various sections?

[eluser]aidanmcg33[/eluser]
i have a widget which brings the user to a form. then enter a value o the form. it saves it to the datbase and then i want to bring them back to the dashboard again.

[eluser]adamp1[/eluser]
you just need to do a redirect the home page
Code:
redirect('auth/home');

[eluser]aidanmcg33[/eluser]
thank you.




Theme © iAndrew 2016 - Forum software by © MyBB