我对PHP很陌生,我想知道我是否能对下面的代码得到一些反馈,我不明白为什么它不起作用。
$i = 0;
$companyService = $_POST['companyService']; // Array variable
for ($i; $i<count($companyService); $i++) {
$service = $companyService[$i];
echo $service; // works and provides correct value
echo $companyId; // works and provides correct value
$queryService = "INSERT INTO `companySpTable` (`companyId`,`serviceId`) VALUES ('".mysqli_real_escape_string($link,$companyId)."' ,'".mysqli_real_escape_string($link,$service)."'";
if(!mysqli_query($link,$queryService)) {
$error = "<p> Query not executed</p>".$error;
}