Using Merge function with arrays
Posted: Fri Oct 11, 2013 12:24 am
Is there a trick to being able to use the Merge function with array elements, or do I have to pull the data out of each element and put it into a variable before merging?
I looked around in the forums, but was unable to find anything.
Here is the merge I am trying to do:
the elements of $_POST are:
$_POST["system_uid"] = TESTING
$_POST["name"] = TEST ID
$_POST["system_id"] = TESTSYSTEM
$_POST["mgr_ldap_uid"] = 1234567
INSERT INTO idmap_systems (system_uid, name, system_id, mgr_ldap_uid) VALUES ('[[$_POST["system_uid"]]]','[[$_POST["name"]]]','[[$_POST["system_id"]]]','[[$_POST["mgr_ldap_uid"]]]')
And, of course, I am ending up with
INSERT INTO idmap_systems (system_uid, name, system_id, mgr_ldap_uid) VALUES (']',']',']',']')
I'm going to go ahead and just pull the elements out into variables, so this is more curiosity/a chance to learn than anything else. I mean, it totally makes sense that this would not work because of the use of square brackets by both, but I would be surprised if there were not some way to directly use the elements of an array with merge.
I looked around in the forums, but was unable to find anything.
Here is the merge I am trying to do:
the elements of $_POST are:
$_POST["system_uid"] = TESTING
$_POST["name"] = TEST ID
$_POST["system_id"] = TESTSYSTEM
$_POST["mgr_ldap_uid"] = 1234567
INSERT INTO idmap_systems (system_uid, name, system_id, mgr_ldap_uid) VALUES ('[[$_POST["system_uid"]]]','[[$_POST["name"]]]','[[$_POST["system_id"]]]','[[$_POST["mgr_ldap_uid"]]]')
And, of course, I am ending up with
INSERT INTO idmap_systems (system_uid, name, system_id, mgr_ldap_uid) VALUES (']',']',']',']')
I'm going to go ahead and just pull the elements out into variables, so this is more curiosity/a chance to learn than anything else. I mean, it totally makes sense that this would not work because of the use of square brackets by both, but I would be surprised if there were not some way to directly use the elements of an array with merge.