I am trying to update one row in my database like this.
if (isset($_POST['submit'])) {
$sizes = array($_POST['size_king'],
$_POST['size_queen'],
$_POST['size_double']
);
mysqli_query($con, "UPDATE beds
SET `Available Sizes` = '$sizes'
WHERE ID = '$prod_id' "
);
}
Can anyone please help me?
I want this data to only update one row, and the data must be separated by a comma.
I am thinking maybe a FOR loop, but I'm not quite sure.
just use implode() function .
if (isset($_POST['submit'])) {
$sizes = array($_POST['size_king'],
$_POST['size_queen'],
$_POST['size_double']
);
$sizes=implode(",",$sizes);
mysqli_query($con, "UPDATE beds
SET `Available Sizes` = '$sizes'
WHERE ID = '$prod_id' "
);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments