0

I have a cakephp application that i want to save posted to my base

I'm using following code in controller :

$ = $this->request->;
$['Link']['url'] = (',',$['Link']['url']);
$this->link->save($);

var_dump :

array(1) { ["Link"]=> array(2) { ["url"]=> array(2) { [0]=> (8) "first" [1]=> (5) "second" } ["linkset_id"]=> (1) "4" } }

My table structure: links table --> ID, url, linkset_id

But i get following error Column not found: 1054 Unknown column 'Array' in 'field list'

How to save this to base ?

osos
  • 2,103
  • 5
  • 28
  • 42

1 Answers1

0

I think this is because

$this->link->save($);

has a field named array probably because there is an empty fieldname somewhere. I would look at

[0]=> (8) "first"

There is no name for this array like

["Link"]=> array(2)

So the database is looking for a fieldname of Array which is not in your db table. Thus, the error

Column not found: 1054 Unknown column 'Array' in 'field list' 

To verify, i'd add a column named Array in your table and see what happens.

thedr
  • 70
  • 3