i need to insert list of string into mysql, so how do i do it?
<?php
require "connection.php";
$res_rname= "Baler";
$res_per_name= "ken";
$res_id= "102";
$datess="2018-08-16, 2018-08-17, 2018-08-17";
$mydate=explode(',',$datess);
$dates = $mydate;
$sql_query = "Insert into res_event_table ( res_id, res_check_in_out,
res_room_name, res_name) values ( '$res_id','$val', '$res_rname',
'$res_per_name')";
if($dates>0)
{
foreach($dates as $val){
$result = mysqli_query($conn ,$sql_query);
if (!$result){
echo "failed" .mysqli_connect_error;
}else{
echo "Reservation Success";
}
}
}
?>
this is how far i get, it insert the other value but the list of date string leaves empty space in my database i read this but it doesnt work for me i dont know why.
echo "failed" .mysqli_connect_error;that isn't the correct error checking method. That's for connection, not for querying.