From 6789cb493eefd9af4167aafd0d418df308d5612d Mon Sep 17 00:00:00 2001 From: Waldo Jaquith Date: Fri, 10 Jan 2020 22:18:57 -0500 Subject: [PATCH] Start to create district functionality Toward #349. --- htdocs/includes/class.District.php | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 htdocs/includes/class.District.php diff --git a/htdocs/includes/class.District.php b/htdocs/includes/class.District.php new file mode 100644 index 00000000..8f7dfd12 --- /dev/null +++ b/htdocs/includes/class.District.php @@ -0,0 +1,32 @@ +connect_mysqli(); + + $sql = 'SELECT id, chamber, number, description, notes + FROM districts + WHERE + date_ended = "0000-00-00" + AND chamber=' . mysqli_real_escape_string($GLOBALS['db'], $chamber) . ' + AND number=' . mysqli_real_escape_string($GLOBALS['db'], $number); + + $result = mysqli_query($GLOBALS['db'], $sql); + if (mysqli_num_rows($result) == 0) + { + return FALSE; + } + $district = mysqli_fetch_assoc($result); + + # Clean it up. + $district = array_map('stripslashes', $district); + + return $district; + + } + +}