I have an array of values (not associative) that I'd like to insert to the database. First, I thought that this simple line of code will do this for me:
$this->SQL->Insert('MyTable', $Data);
But it didn't work.
I checked class.mysqldriver.php, function GetInsert and found what I know: when you have an associative array of FieldName => Value pairs, it works like a charm.
Quite a common case when you just have your values to be inserted and you don't want to specify column names like:
INSERT INTO tbl_name VALUES(myvalue1, myvalue2, ... , myvalueX);
I think the function should handle that.
How can I avoid to build an associative array of FieldName => Value pairs?
Please explain.
0 · ·
Answers
the models are not quite ORM, but you want to specify what you want inserted in which column. Good practice. Also your code will make more sense.
Btw you can get as an associative array.
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
1 · Insightful 1Awesome LOL ·Needless.
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·