Last active
August 29, 2015 13:57
-
-
Save MrQwest/9761627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
ini_set('display_errors', 'On'); | |
error_reporting(-1); | |
// edited for security reasons... obvs | |
$con = new mysqli("localhost", "x", "x", "x"); | |
if($con->connect_errno > 0){ | |
die('Unable to connect to database [' . $con->connect_error . ']'); | |
} | |
$conid = $_GET["id"]; | |
?> | |
<html> | |
<head> | |
<title>Contractor Edit</title> | |
</head> | |
<body> | |
<? | |
$name = $_POST['name']; | |
$location = $_POST['location']; | |
$service = $_POST['service']; | |
$telephone = $_POST['telephone']; | |
$fax = $_POST['fax']; | |
$mobile = $_POST['mobile']; | |
$website = $_POST['website']; | |
$contact1 = $_POST['contact1']; | |
$email1 = $_POST['email1']; | |
$phone1 = $_POST['phone1']; | |
$contact2 = $_POST['contact2']; | |
$email2 = $_POST['email2']; | |
$phone2 = $_POST['phone2']; | |
$contact3 = $_POST['contact3']; | |
$email3 = $_POST['email3']; | |
$phone3 = $_POST['phone3']; | |
$notes = $_POST['notes']; | |
$sql = SQL | |
UPDATE `contractors` | |
SET `name` = $name, | |
`location` = $location, | |
`service` = $service, | |
`telephone` = $telephone, | |
`fax` = $fax, | |
`mobile` = $mobile, | |
`website` = $website, | |
`contact1` = $contact1, | |
`email1` = $email1, | |
`phone1` = $phone1, | |
`contact2` = $contact2, | |
`email2` = $email2, | |
`phone2` = $phone2, | |
`contact3` = $contact3, | |
`email3` = $email3, | |
`phone3` = $phone3, | |
`notes` = $notes | |
WHERE `id` = $conid | |
SQL; | |
$prepare = $db->prepare($sql); | |
$prepare->execute(); | |
$db->close(); | |
?> | |
<p>You've edited the entry for <? echo $_POST['name']; ?>, nice work!</p> | |
<p><a href="index.php" title="back to the index">Back to the index.</a></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment