[eluser]tjackson1982[/eluser]
Puzzle becomes an impossibility.
I changed the posting function and this is what I get.
Controller
Code:
function posting_headline()
{
$headline = $_POST['headline'];
$source = $_POST['source'];
$link = $_POST['link'];
$image_link = $this->input->post('img_link');
$author = $this->input->post('author');
$views = $this->input->post('view');
$catagory = $this->input->post('catagory');
$date_time=time();
if ( $this->input->post('headline') !== FALSE ) {
$this->Posting->posting($headline,$source,$link,$image_link,$author,$views,$catagory);
}
}
Model
Code:
function posting($headline_in, $source_in, $link_in, $image_link_in, $author_in, $catagory_in ) {
$sql = "INSERT INTO headline (headline, source, link, image_link, author, catagory, date_time)
VALUES (".$this->db->escape($headline_in).", ".$this->db->escape($source_in).", ".$this->db->escape($link_in).", ".$this->db->escape($image_link_in).", ".$this->db->escape($author_in).", ".$this->db->escape($catagory_in).", ".time().")";
echo $sql;
$this->db->query($sql);
$date_time = time();
$data = array(
'headline' => $headline_in,
'source' => $source_in,
'link' => $link_in,
'image_link' => $image_link_in,
'author' => $author_in,
'catagory' => $catagory_in,
'date_time' => $date_time
);
//$this->db->insert('headline', $data);
}
Output.
A PHP Error was encountered
Severity: Notice
Message: Undefined index: source
Filename: controllers/Posting.php
Line Number: 23
A PHP Error was encountered
Severity: Notice
Message: Undefined index: link
Filename: controllers/Posting.php
Line Number: 24
INSERT INTO headline (headline, source, link, image_link, author, catagory, date_time) VALUES ('Android Dev makes it big', NULL, NULL, 0, 0, 0, 1234307746)
A Database Error Occurred
Error Number: 1048
Column 'source' cannot be null
INSERT INTO headline (headline, source, link, image_link, author, catagory, date_time) VALUES ('Android Dev makes it big', NULL, NULL, 0, 0, 0, 1234307746)
Notice the Insert INTO has the correct Headline which was received by $_POST yet the Source and link are NULL and they too are using $_POST to get info.
Why does this only send one variable?