Welcome Guest, Not a member yet? Register   Sign In
Official Blog Tutorial: db->insert insert error with $_POST
#1

[eluser]php-zbatev[/eluser]
hi,

I followed the blog tutorial and i am almost through but I'm have this problem with the
given insert statement:

function comment_insert()
{
$this->db->insert('comments',$_POST);
redirect('blog/comments/'.$_POST['entry_id']);
}
---------------------------------------------------------------------------------------
and ended up with this error:

An Error Was Encountered

Error Number: 1054

Unknown column 'Submit_Comment' in 'field list'

INSERT INTO `comments` (`entry_id`, `body`, `author`, `Submit_Comment`)
VALUES ('1', 'comment nako ni', 'z', 'Submit Query')
---------------------------------------------------------------------------------------
the Submit Comment is a submit button:
<p>&lt;input type="submit" name="Submit Comment"/&gt;</p>

I think that the error was triggered by $this->db->insert('comments',$_POST); but my question is why did it work in the vid tutorial, where do you think did I miss out?


Messages In This Thread
Official Blog Tutorial: db->insert insert error with $_POST - by El Forum - 05-09-2008, 03:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB