I am very new to PHP and I was wondering if I could get some feedback on the code below, I don't see why its not working.
$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;
    }
 
    