PHPRad Classic Initial 2.7.3 Forum

PHPRad Forum => Questions => Topic started by: daninet on January 30, 2024, 04:13:30 PM

Title: trigger
Post by: daninet on January 30, 2024, 04:13:30 PM
salve ho 2 tabelle
1- prenotazioni
1- postazioni
nella tabella prenotazioni inserisco la postazione.
Ho la necessita che dopo avere inserito la prenotazione devo impostare un campo nella tabella postazioni su occupato.
Title: Re: trigger
Post by: daninet on February 06, 2024, 09:40:24 AM
Il trigger fa questo su after insert della tabella prenotazioni
UPDATE postazioni
SET postazioni.status='OCC'
WHERE postazioni.id = new.postazione_id "

questo รจ su page events ma non so come impostarlo

$table_data = array(
    "fieldname" => "value",
    "fieldname2" => "value2"
);
$db->where("table_id", $rec_id);
$bool = $db->update("tablename", $table_data);
Title: Re: trigger
Post by: daninet on February 06, 2024, 11:59:59 AM
after insert - tabella prenotazioni

$table_data = array(
    "status" => "OCC",
    "postazione_id" => $rec_id
);
$db->where("id", $rec_id);
$bool = $db->update("postazioni", $table_data);

se inserisco questo codice ho error 500