1
0
mirror of https://github.com/fspc/Yellow-Bike-Database.git synced 2025-02-22 08:53:23 -05:00

Fixed two bugs with interest survey.

1)  Removed UNIQUE from selections.selection
2)  SELECT query added contact_id

nicer
This commit is contained in:
Jonathan Rosenbaum 2015-03-06 18:39:59 +00:00
parent 5a36eea47b
commit 71aa35af00
4 changed files with 7 additions and 5 deletions

View File

@ -88,7 +88,7 @@ define("VOLUNTEER_INTEREST_COMMENTS", true);
// //
// $volunteer_interests_changename = array("League Certified Instructor" => "LCI"); // $volunteer_interests_changename = array("League Certified Instructor" => "LCI");
// Delete an interest(s) name. // [BUGGY - don't use it] Delete an interest(s) name.
// //
// 1. Add the interest(s) you want to delete. Please understand // 1. Add the interest(s) you want to delete. Please understand
// that by doing this you will delete the interest and all associated data. // that by doing this you will delete the interest and all associated data.

View File

@ -2,4 +2,5 @@ Positive Spin is a volunteer-run organization. Your volunteered time, and our
ability to benefit the community with our exciting services and programs are ability to benefit the community with our exciting services and programs are
directly related. We can provide funding for various committees. Please indicate directly related. We can provide funding for various committees. Please indicate
if you would be interested in helping us with any of the following management if you would be interested in helping us with any of the following management
needs, operations, events and programs: needs, operations, events and programs.
Update your interests any time you are in the shop:

View File

@ -163,7 +163,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
// Find out if any selections are in the database, // Find out if any selections are in the database,
// to decide whether an INSERT or DELETE needs to be done // to decide whether an INSERT or DELETE needs to be done
$sql = "SELECT selection FROM selections;"; $sql = "SELECT selection FROM selections WHERE contact_id=" . $_POST['contact_id'] . ";";
$query = mysql_query($sql, $YBDB) or die(mysql_error()); $query = mysql_query($sql, $YBDB) or die(mysql_error());
$selections = []; $selections = [];
while ($result = mysql_fetch_assoc($query)) { while ($result = mysql_fetch_assoc($query)) {
@ -185,7 +185,8 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
} }
} }
} }
// insert as update? But it works.
if ($_POST['comments']) { if ($_POST['comments']) {
$sql = "INSERT INTO selections (contact_id, selection, selection_value) $sql = "INSERT INTO selections (contact_id, selection, selection_value)
VALUES (" . $_POST['contact_id'] . ", 1,'" . $_POST['comments'] . "');"; VALUES (" . $_POST['contact_id'] . ", 1,'" . $_POST['comments'] . "');";

View File

@ -209,7 +209,7 @@ CREATE TABLE IF NOT EXISTS options (
-- --
CREATE TABLE IF NOT EXISTS selections ( CREATE TABLE IF NOT EXISTS selections (
contact_id int(10) unsigned, contact_id int(10) unsigned,
selection int(10) unsigned UNIQUE, selection int(10) unsigned,
selection_value text, selection_value text,
FOREIGN KEY (contact_id) REFERENCES contacts (contact_id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (contact_id) REFERENCES contacts (contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (selection) REFERENCES options (option_name_id) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (selection) REFERENCES options (option_name_id) ON DELETE CASCADE ON UPDATE CASCADE