prepare(" INSERT INTO Hosts(IpAddress, NetworkId, Hostname, FQDN, MacAddress, Comments) VALUES($ip, $networkId, :i_hostname, :i_fqdn, :i_macAddress, :i_comments) ON DUPLICATE KEY UPDATE Hostname = :u_hostname, FQDN = :u_fqdn, MacAddress = :u_macAddress, Comments = :u_comments "); $update->execute([ 'i_hostname' => $_POST["Hostname"], 'i_fqdn' => $_POST["FQDN"], 'i_macAddress' => $_POST["MacAddress"], 'i_comments' => $_POST["Comments"], 'u_hostname' => $_POST["Hostname"], 'u_fqdn' => $_POST["FQDN"], 'u_macAddress' => $_POST["MacAddress"], 'u_comments' => $_POST["Comments"] ]); } catch(Exception $e) { header("HTTP/1.x 500 " . $e->getMessage()); die($e->getMessage()); } ?>