ho un problema che non riesco a uscirne fuori mi da questo errore quando ho cancellato un record :

Warning: Invalid argument supplied for foreach() in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\lprova\management.php on line 2286


Codice PHP:

case 'modify_offert_form':
    $id_offert = $_POST['activity_id'];
    $id_remove_offert = $_POST['activity_remove'];
    if (is_not_null_not_blank($id_offert))
    {    if (is_not_null_not_blank($id_remove_offert))
            $testo_offert = "Rimozione di un messaggio nella pagina Offerte";
        else
            $testo_offert = "Modifica di un messaggio nella pagina Offerte";
        $offert = $db->query_single_object("SELECT * FROM attributes WHERE attributes.attribute_id = $id_offert");
        $name_offert = $offert->title;
        $description_offert = $offert->description;
        $order_offert = $offert->priority;
    }
    else
    {
        $testo_offert = "Inserimento di un messaggio nella pagina Offerte";
        $order_offert = 1;
    }
    ?>
    <h2><? echo($testo_offert); ?></h2><hr class="title_line" />
    <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post">
        Nome Offerta:

        <input type="text" name="nome_offert" <?php if($id_remove_offert) echo ("readonly='true'");?>" value="<?php echo $name_offert?>" style="width:400px;" />
        


        Ordine:

        <input type="number" name="ordine_offert" <?php if($id_remove_offert) echo ("readonly='true'");?>" min="1" max="10000" step="1" value="<?php echo $order_offert?>" style="width:50px;" />
        


        Descrizione:

        <textarea name="descrizione_offert" <?php if($id_remove_offert) echo ("readonly='true'");?>" rows=6 style="width:400px;">
            <?echo(trim($description_offert));?>
        </textarea>
        


        <input type="hidden" name="activity" value="modify_offert_execution" />
        <input type="hidden" name="activity_id" value="<?php echo $id_offert?>" />
        <input type="hidden" name="activity_remove" value="<?php echo $id_remove_offert?>" />
        <?
            
if (is_not_null_not_blank($id_offert))
            {
                if (
is_not_null_not_blank($id_remove_offert))
                    echo 
"<input type='submit' value='Rimuovi' />";
                else
                    echo 
"<input type='submit' value='Aggiorna' />";
            }
            else
                echo 
"<input type='submit' value='Salva' />";
            
            if (!
is_not_null_not_blank($id_remove_offert))
                echo (
"<input type='reset' value='Ripristina' />");
        
?>
        
    </form>
    <?php
    
break;


//e da qui poi passa i parametri qua


# 29.
case 'modify_offert_execution':
    
# Controllo che nessuno dei settaggi sia vuoto o nullo.
    
if (!(is_not_null_not_blank($_POST['nome_offert']) &&
            
is_not_null_not_blank($_POST['ordine_offert']))) {
        echo(
management_message('Attenzione!''Tutti i campi sono obbligatori.'));
        
# Impostazione del valore di $error, per creare correttamente
        # il tasto di reindirizzamento a fondo pagina.
        
$error TRUE;
        break;
    }
    
    
# Reimpostazione vera e propria dei settaggi.
    
try {
        
$nome_offert trim($_POST['nome_offert']);
        
$ordine_offert $_POST['ordine_offert'];
        
$descrizione_offert trim($_POST['descrizione_offert']);
        
$id_offert $_POST['activity_id'];
        
$id_remove_offert $_POST['activity_remove'];
        
        if (
is_not_null_not_blank($id_offert))
        {
            if (
is_not_null_not_blank($id_remove_offert))
            {
                
$file_offert_array $db->query_objects_array("SELECT * FROM files WHERE files.attribute_id = $id_offert");
                
# Recupero la path
                
$pathimage substr($_SERVER['SCRIPT_FILENAME'], 0strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], "/")));
                foreach (
$file_offert_array as $file_offert_array_element)
                {
                    
unlink("$pathimage/files/$file_offert_array_element->name");
                    
$db->query_no_result("DELETE FROM files WHERE file_id = $file_offert_array_element->file_id");
                }
                
$db->query_no_result("DELETE FROM attributes WHERE attribute_id = $id_offert");
            }
            else
                
$db->query_no_result("UPDATE attributes    SET title = '$nome_offert', priority = '$ordine_offert', description = '$descrizione_offert' WHERE attribute_id = $id_offert");
        }
        else
            
$db->query_no_result("INSERT INTO attributes (title,description,priority,sector_id) VALUES ('$nome_offert','$descrizione_offert',$ordine_offert,3)");
            
        echo(
management_message('Operazione completata',
                                
'Modifica dela offerta eseguita con successo.

'
));
    } catch(
Exception $e) {
        echo(
management_message('Attenzione!''Modifica del messaggio chi siamo eseguita senza successo.' .
                                    
'
$e->getMessage()));
        
# Impostazione del valore di $error, per creare correttamente
        # il tasto di reindirizzamento a fondo pagina.
        
$error TRUE;
    }
    break;
grazie a tuttiiiii