Welcome Guest, Not a member yet? Register   Sign In
Store Image path into DB
#3

[eluser]Shella[/eluser]
Thanks for reply.
Unfortunately this is exactly my drama.

If I use this code:

Code:
$new_article_insert_data = array(
  'title' => $this->input->post('title'),
  'content' => $this->input->post('content'),
  'image' => $this->upload->data['file_name'], //THIS IS A TRY
  'id_category' => $this->input->post('category'),
  'created_on' =>  $created_on,
  );

I get this error:

Severity: Notice

Message: Undefined property: CI_Upload::$data

Filename: models/articles_model.php

...and if I use this:

Code:
$new_article_insert_data = array(
  'title' => $this->input->post('title'),
  'content' => $this->input->post('content'),
  'image' => $this->upload->data('file_name'), //THIS IS ANOTHER TRY
  'id_category' => $this->input->post('category'),
  'created_on' =>  $created_on,
  );



I get this error:

Severity: Notice

Message: Array to string conversion

Filename: mysql/mysql_driver.php

This last is trying to write a general "array" into the database:

Code:
INSERT INTO `articles` (`title`, `content`, `image`, `id_category`, `created_on`) VALUES ('Post Title', '\r\n Example data', Array, '44', '2012-06-14 15:19:28')

...I feel so dumb.. but I can't understand this logic...




Messages In This Thread
Store Image path into DB - by El Forum - 06-14-2012, 03:15 AM
Store Image path into DB - by El Forum - 06-14-2012, 07:45 AM
Store Image path into DB - by El Forum - 06-14-2012, 08:21 AM
Store Image path into DB - by El Forum - 06-18-2012, 01:04 PM
Store Image path into DB - by El Forum - 06-23-2012, 02:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB