[eluser]CodyPChristian[/eluser]
So I'm having some werid issues with a function. All of the code is bellow. I can explain what the freakauth stuff does if needed
.
This is how the table is setup: id,nick,from,subject,date,message,new
Here is my function:
Code:
function send_new()
{
$data['nick'] = $this->freakauth_light->getUserName();
$data['base_url'] = $this->config->item('base_url');
$this->db->insert('messages', $_POST);
//print_r($_POST);
redirect('admin/messages');
}
Here is my view:
Code:
<?=form_open('admin/messages/send_new');?>
<?=form_hidden('id', '');?>
<p>To:<input type="text" name="nick" /></p>
<?=form_hidden('from', $this->freakauth_light->getUserName());?>
<p>Subject:<input type="text" name="subject" /></p>
<p>Date:<input type="text" name="date" /></p>
<p>Message:<br /><textarea name="message" rows="15" cols="60" ></textarea></p>
<?=form_hidden('new', '1');?>
<p><input type="submit" value="Send Message" /></p>
</form>
and here is my error:
Code:
An Error Was Encountered
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, subject, date, message, new) VALUES ('', 'Eckypro', 'CodyPChristian', 'Sub' at line 1
INSERT INTO messages (id, nick, from, subject, date, message, new) VALUES ('', 'Eckypro', 'CodyPChristian', 'Subject here', '7/11/2007', 'message here ;)', '1')