I’m new to PHP and I need help with a few things. First I need to merge two arrays together and separate them using a comma and then I need to be able to update my database to insert the result of the merged arrays into one row. To further explain I have a database table called contents. What I want to do in this table is so I need the result of the merge array to be inserted into tierString this is a varchar and not an int but I need it to take in two numbers:
id | name | desc | tierString
1 name1 blah 1,2
This is my function to update the database:
function updateTierString($tier_array){
$result = false;
foreach($tier_array as $content_id => $tier){
$update = “UPDATE CONTENTS
SET
tier_string = $tier,
updated = NOW()
WHERE
id = ‘$content_id’”;
$update = db_query($update);
}
return $result;
So my issue is I want to merge two arrays together and then separate them using a comma and then insert it into the database. The two arrays would contain integers but I want to turn it into a string. Is it possible?