php - PDO Insert values from subarrays
Get the solution ↓↓↓array(2) {
[0]=>
array(1) {
["url_id"]=>
string(2) "45"
}
[1]=>
array(1) {
["h"]=>
string(1) "3"
}
}
echo $column_list = join(',', $items);
...
This PDO Insert Array Using Key As Column Name helps me inserting array values in MySQL table easily. But now I do have an array containing subarrays and it looks like thisjoin(',', $items);
does not work. Guess you think "of course it doesn't work" right now, but how can I store the keys and the values into a variable to use$sql = "INSERT INTO applications ($column_list) VALUES ($param_list)";
successfully.
I have triedarray_merge
but that did not work at all. I would like to show some code examples, but I have no idea what to try and how to achieve that.
Thanks for your help! I appreciate it!
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: attempt to read property "id" on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.