Reputation: 5628
I am using laravel 5.2, I am stuck in a case,Where i have one db field product_specs
and 5 form input
inserting their values to that same product_specs
database field.
My question is that how can i add comma to values and then insert it to the database field product_specs
.
Then i will be able to use php function explode()
to remove the comma and use the result.
Upvotes: 1
Views: 335
Reputation: 202
just concatenate and insert on db ?
$product_specs = $value1 . ',' . $value2 . ',' .....;
//insert $product_specs on db field product_specs
then when need fetch the data and implode the previous answer
hope it helps if thats your question
Upvotes: -1
Reputation: 163898
How about the implode() function?
$comma_separated = implode(",", $array);
Upvotes: 4