TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Data doesnt accepting by DB or smth like this....HELP
  • Hello! I`ve got a problem, i fill a text form and i try to send data into DB, it is success but, fields in the DB table are empty.... Data send, saves into DB, but the created fields are empty....What could it be? I use Kohana v3.2, ORM module for work with database.

    There`s code of controller:

    public function action_addNews()
                $news = Arr::extract($_POST, array('name', 

    And here`s code of model

    <?php defined('SYSPATH') or die('No direct script access.');
    class Model_Articles extends ORM{
        protected $_table_name = 'articles';
        public function addArticle($news)
                ->set('news_name', $news['name'])
                ->set('news_text', $news['text'])

    Thank everybody, who`s help.

  • How does that work? Your model is accepting 1 parameter but you've sent it loads.

    If the data is going in empty, you need to debug, so do a echo Debug::vars($news) right after the array extract, to make sure it's not an issue with the form.

    Also, the addArticle method should be static, called via Model_Articles::addArticle($news)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion