-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheditwaterbodynotes.php
54 lines (37 loc) · 1.35 KB
/
editwaterbodynotes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
session_start();
// EDIT WATERBODY NOTES
// this script takes the output of the edit box on waternew.php
// and updates the DB based on the 'notes'
// whoa I didn't know you could edit code right on GitHub!!
?>
<link rel="stylesheet" type="text/css" href="style.css"/>
<?
include 'config.php';
include 'connect.php';
include 'header.php';
print $header;
///////////////////// RESULTS //////////////////////
print "<br><br><br><br>";
// get the current time (for "last updated" field in DB)
$now = date("Y-m-d H:i:s"); // set the $now in UTC (for "last update" column)
////////////// GET STUFF ////////////////
$notes = $_GET['notes'];
$waterbodyid = $_GET['waterbodyid'];
//////////////////// FIX APOSTROPHES /////////////////////////////////////////
// make it so apostrophes work
$notes = mysql_real_escape_string($_GET[notes]);
$waterbodyname = mysql_real_escape_string($_GET[waterbodyname]);
print "the new notes are $notes<br>";
//////////////////// SEND TO THE DATABASE! whoohoooo //////////////////////
$sql="UPDATE waterbodies SET notes = '$notes' WHERE id = $waterbodyid";
// show us the query
print "<br> -------- THE SQL QUERY --------- <br><pre>$sql</pre>";
// Tell us the results
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error()); // error message
}
mysql_close($con);
print "THIS IS AFTER THE CONNECTION CLOSES";
?>