I want to insert array value into database single row and column
$str_accommodation_level = "SELECT * FROM interest";
$query_accommodation_level = $dbcon->query($str_accommodation_level);
while ($accommodation_level = $query_accommodation_level->fetch_array()) {
$level_from = 'type' . $accommodation_level['id'];
if (isset($_COOKIE[$level_from])) {
$level_data += '<span>' . $_COOKIE[$level_from] . '</span> <br>';
}
print $level_data;
}
use php implode
. The implode()
function returns a string
from the elements of an array
.
$arr = array('1','2','3','4');
$str=implode(",",$arr);
or insert like that :-
INSERT INTO table_name (column1)
VALUES ('$str')
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments