mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 17:03:22 -05:00
This resolves the issue with contacts created on multiple terminals.
0) concurrency issue, one contact_id was edited by 2 or more terminals 1) Better than having a new contact_id created everytime the contact_add_edit page is opened which was the behavior of the original program. 2) Still need to clean-up the code a little, and do a little bit more testing, but appears to be working nicely. 3) Still uses GET for initial setup, a todo to change. 4) Glad the bug was found, and now is fixed.
This commit is contained in:
parent
ef058ba56b
commit
a671e41ffd
@ -35,13 +35,10 @@ default:
|
|||||||
$page_shop_log = PAGE_SHOP_LOG . "?shop_id=$shop_id";
|
$page_shop_log = PAGE_SHOP_LOG . "?shop_id=$shop_id";
|
||||||
|
|
||||||
|
|
||||||
|
// setup the proper form action and form values .. not that $_GET is such a brilliant approach :)
|
||||||
if($_GET['contact_id'] == 'new_contact'){
|
if($_GET['contact_id'] == 'new_contact'){
|
||||||
|
|
||||||
|
|
||||||
/* Discover if previous contact creation attempt was abandoned
|
|
||||||
There should be at least a first and last name, if not we use
|
|
||||||
previous contact_id, update it and start fresh
|
|
||||||
*/
|
|
||||||
mysql_select_db($database_YBDB, $YBDB);
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
|
|
||||||
// Find previous contact_id
|
// Find previous contact_id
|
||||||
@ -50,35 +47,10 @@ if($_GET['contact_id'] == 'new_contact'){
|
|||||||
$result = mysql_fetch_assoc($query);
|
$result = mysql_fetch_assoc($query);
|
||||||
$previous_contact_id = $result['previous_contact_id'];
|
$previous_contact_id = $result['previous_contact_id'];
|
||||||
|
|
||||||
// If full_name is empty we will use this contact_id
|
|
||||||
$sql = "SELECT CONCAT(first_name, ' ', last_name) as full_name FROM contacts WHERE contact_id=" . $previous_contact_id. ";";
|
|
||||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
|
||||||
$result = mysql_fetch_assoc($query);
|
|
||||||
|
|
||||||
$full_name = $result['full_name'];
|
$new_contact_id = $previous_contact_id + 1;
|
||||||
|
$contact_id = $new_contact_id;
|
||||||
//adds contact if new_contact is selected .. it's " " not ""
|
$contact_id_entry = 'new_contact';
|
||||||
if ($full_name != " ") {
|
|
||||||
|
|
||||||
$new_contact_id = $previous_contact_id + 1;
|
|
||||||
|
|
||||||
$insertSQL = sprintf("INSERT INTO contacts (date_created) VALUES (%s)",
|
|
||||||
GetSQLValueString('current_time', "date"));
|
|
||||||
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
|
|
||||||
|
|
||||||
$contact_id = $new_contact_id;
|
|
||||||
$contact_id_entry = 'new_contact';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$insertSQL = sprintf("UPDATE contacts SET date_created=%s WHERE contact_id=" . $previous_contact_id,
|
|
||||||
GetSQLValueString('current_time', "date"));
|
|
||||||
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
|
|
||||||
|
|
||||||
$contact_id = $previous_contact_id;
|
|
||||||
$contact_id_entry = 'new_contact';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} elseif(isset($_GET['contact_id'])) {
|
} elseif(isset($_GET['contact_id'])) {
|
||||||
@ -90,27 +62,97 @@ if($_GET['contact_id'] == 'new_contact'){
|
|||||||
$contact_id_entry = -1;
|
$contact_id_entry = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$editFormAction = "?contact_id={$contact_id}&shop_id={$shop_id}";
|
|
||||||
|
|
||||||
|
$editFormAction = "?contact_id={$contact_id}&shop_id={$shop_id}";
|
||||||
|
|
||||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
||||||
|
|
||||||
$updateSQL = sprintf("UPDATE contacts SET first_name=%s, middle_initial=%s, last_name=%s, email=%s,
|
|
||||||
DOB=%s, phone=%s, address1=%s, address2=%s, city=%s,
|
/* Discover if submitted contact creation attempt is new.
|
||||||
`state`=%s, zip=%s, pass=ENCODE(%s,'yblcatx') WHERE contact_id=%s",
|
There should be at least a first and last name.
|
||||||
GetSQLValueString($_POST['first_name'], "text"),
|
*/
|
||||||
GetSQLValueString($_POST['middle_initial'], "text"),
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
GetSQLValueString($_POST['last_name'], "text"),
|
|
||||||
GetSQLValueString($_POST['email'], "text"),
|
$query = 'SELECT MAX(contact_id) as contact_id FROM contacts;';
|
||||||
GetSQLValueString($_POST['DOB'], "date"),
|
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
GetSQLValueString($_POST['phone'], "text"),
|
$result = mysql_fetch_assoc($sql);
|
||||||
GetSQLValueString($_POST['address1'], "text"),
|
$submitted_contact_id = $result['contact_id'] + 1;
|
||||||
GetSQLValueString($_POST['address2'], "text"),
|
|
||||||
GetSQLValueString($_POST['city'], "text"),
|
/*
|
||||||
GetSQLValueString($_POST['state'], "text"),
|
$handler->debug("submitted_contact_id",$submitted_contact_id - 1);
|
||||||
GetSQLValueString($_POST['zip'], "text"),
|
$handler->debug("$_POST",$_POST['contact_id']);
|
||||||
GetSQLValueString($_POST['password'], "text"),
|
exit();
|
||||||
GetSQLValueString($_POST['contact_id'], "int"));
|
*/
|
||||||
|
|
||||||
|
// contact already exists it is less than $submitted_contact_id
|
||||||
|
if($submitted_contact_id > $_POST['contact_id']) {
|
||||||
|
$submitted_contact_id = $_POST['contact_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// if contact already exists, $submitted_contact_id now equals $_POST['contact_id], and it isn't new_contact
|
||||||
|
if ($submitted_contact_id != $_POST['contact_id'] || $_POST === 'new_contact') {
|
||||||
|
$submitted_contact_id = $_POST['contact_id'];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// If full_name is empty we will use this contact_id
|
||||||
|
$sql = "SELECT CONCAT(first_name, ' ', last_name) as full_name FROM contacts WHERE contact_id=" . $submitted_contact_id . ";";
|
||||||
|
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
|
$result = mysql_fetch_assoc($query);
|
||||||
|
$full_name = $result['full_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//adds contact if new_contact is selected .. it's " " not ""
|
||||||
|
if (empty($full_name)) {
|
||||||
|
$contact_id_entry = 'new_contact';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $contact_id_entry === 'new_contact' ) {
|
||||||
|
|
||||||
|
// Get the actual contact_id because it may have changed on multiple terminals
|
||||||
|
$query = 'SELECT MAX(contact_id) as contact_id FROM contacts;';
|
||||||
|
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
|
$result = mysql_fetch_assoc($sql);
|
||||||
|
$submitted_contact_id = $result['contact_id'] + 1;
|
||||||
|
|
||||||
|
// Insert new contact information into a new record
|
||||||
|
$updateSQL = 'INSERT INTO contacts (contact_id, first_name, middle_initial, last_name, email,' .
|
||||||
|
' phone, address1, address2, city, state, DOB, receive_newsletter, waiver, pass, zip)' .
|
||||||
|
' VALUES (' .
|
||||||
|
$submitted_contact_id . ', ' .
|
||||||
|
'"' . $_POST['first_name'] . '", ' .
|
||||||
|
'"' . $_POST['middle_initial'] . '", ' .
|
||||||
|
'"' . $_POST['last_name'] . '", ' .
|
||||||
|
'"' . $_POST['email'] . '", ' .
|
||||||
|
'"' . $_POST['phone'] . '", ' .
|
||||||
|
'"' . $_POST['address1'] . '", ' .
|
||||||
|
'"' . $_POST['address2'] . '", ' .
|
||||||
|
'"' . $_POST['city'] . '", ' .
|
||||||
|
'"' . $_POST['state'] . '", ' .
|
||||||
|
'"' . $_POST['DOB'] . '", ' .
|
||||||
|
'"' . $_POST['email_list'] . '", ' .
|
||||||
|
1 . ', ' .
|
||||||
|
'ENCODE("' . $_POST['password'] . '",' . '"yblcatx"), ' .
|
||||||
|
'"' . $_POST['zip'] . '");';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Update existing contact record
|
||||||
|
$updateSQL = sprintf("UPDATE contacts SET first_name=%s, middle_initial=%s, last_name=%s, email=%s,
|
||||||
|
DOB=%s, phone=%s, address1=%s, address2=%s, city=%s,
|
||||||
|
`state`=%s, zip=%s, pass=ENCODE(%s,'yblcatx') WHERE contact_id=%s",
|
||||||
|
GetSQLValueString($_POST['first_name'], "text"),
|
||||||
|
GetSQLValueString($_POST['middle_initial'], "text"),
|
||||||
|
GetSQLValueString($_POST['last_name'], "text"),
|
||||||
|
GetSQLValueString($_POST['email'], "text"),
|
||||||
|
GetSQLValueString($_POST['DOB'], "date"),
|
||||||
|
GetSQLValueString($_POST['phone'], "text"),
|
||||||
|
GetSQLValueString($_POST['address1'], "text"),
|
||||||
|
GetSQLValueString($_POST['address2'], "text"),
|
||||||
|
GetSQLValueString($_POST['city'], "text"),
|
||||||
|
GetSQLValueString($_POST['state'], "text"),
|
||||||
|
GetSQLValueString($_POST['zip'], "text"),
|
||||||
|
GetSQLValueString($_POST['password'], "text"),
|
||||||
|
GetSQLValueString($submitted_contact_id, "int"));
|
||||||
|
}
|
||||||
|
|
||||||
mysql_select_db($database_YBDB, $YBDB);
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
|
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
|
||||||
@ -163,7 +205,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 WHERE contact_id=" . $_POST['contact_id'] . ";";
|
$sql = "SELECT selection FROM selections WHERE contact_id=" . $submitted_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)) {
|
||||||
@ -174,13 +216,13 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
|||||||
if ( is_null($selections[$interest_id]) ) { //INSERT
|
if ( is_null($selections[$interest_id]) ) { //INSERT
|
||||||
if( !is_null($interest_checked[$selection]) ) {
|
if( !is_null($interest_checked[$selection]) ) {
|
||||||
$sql = "INSERT INTO selections (contact_id, selection, selection_value)
|
$sql = "INSERT INTO selections (contact_id, selection, selection_value)
|
||||||
VALUES (" . $_POST['contact_id'] . "," . $interest_id . ",1);";
|
VALUES (" . $submitted_contact_id . "," . $interest_id . ",1);";
|
||||||
$result = mysql_query($sql, $YBDB) or die(mysql_error());
|
$result = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
}
|
}
|
||||||
} else { //DELETE
|
} else { //DELETE
|
||||||
if( is_null($interest_checked[$selection]) ) {
|
if( is_null($interest_checked[$selection]) ) {
|
||||||
$sql = "DELETE FROM selections WHERE selection=" . $interest_id .
|
$sql = "DELETE FROM selections WHERE selection=" . $interest_id .
|
||||||
" AND contact_id=" . $_POST['contact_id'] . ";";
|
" AND contact_id=" . $submitted_contact_id . ";";
|
||||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,11 +231,11 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
|||||||
// insert as update? But it works.
|
// 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 (" . $submitted_contact_id . ", 1,'" . $_POST['comments'] . "');";
|
||||||
$result = mysql_query($sql, $YBDB) or die(mysql_error());
|
$result = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['contact_id_entry'] == 'new_contact' || $_POST['contact_id_entry'] == $_POST['contact_id']){
|
if ($_POST['contact_id_entry'] == 'new_contact' || $_POST['contact_id_entry'] == $submitted_contact_id){
|
||||||
|
|
||||||
//navigate back to shop that it came from
|
//navigate back to shop that it came from
|
||||||
$pagegoto = PAGE_SHOP_LOG . "?shop_id={$shop_id}&new_user_id={$contact_id}";
|
$pagegoto = PAGE_SHOP_LOG . "?shop_id={$shop_id}&new_user_id={$contact_id}";
|
||||||
@ -201,7 +243,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // Submitted
|
||||||
|
|
||||||
mysql_select_db($database_YBDB, $YBDB);
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
$query_Recordset1 = "SELECT *, DECODE(pass,'yblcatx') AS passdecode FROM contacts WHERE contact_id = $contact_id";
|
$query_Recordset1 = "SELECT *, DECODE(pass,'yblcatx') AS passdecode FROM contacts WHERE contact_id = $contact_id";
|
||||||
@ -222,7 +264,15 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
|||||||
<table border="0" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
|
<table border="0" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
|
||||||
<tr>
|
<tr>
|
||||||
<td><label class="contacts">Contact_id:</label></td>
|
<td><label class="contacts">Contact_id:</label></td>
|
||||||
<td><?php echo $row_Recordset1['contact_id']; ?></td>
|
<td>
|
||||||
|
<?php
|
||||||
|
if($_GET['contact_id'] == 'new_contact'){
|
||||||
|
echo 'New Contact';
|
||||||
|
} else {
|
||||||
|
echo $row_Recordset1['contact_id'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr >
|
<tr >
|
||||||
<td><label class="contacts">Name:</label></td>
|
<td><label class="contacts">Name:</label></td>
|
||||||
@ -293,7 +343,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
|||||||
<?php include("Connections/waiver.txt"); ?>
|
<?php include("Connections/waiver.txt"); ?>
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
</div><input id="waiver_checkbox" type="checkbox"> I agree <span id="waiver_error"></span>
|
</div><input id="waiver_checkbox" name="waiver_checkbox" type="checkbox"> I agree <span id="waiver_error"></span>
|
||||||
<input type="submit" id="waiver_button" value="Show Waiver" \>
|
<input type="submit" id="waiver_button" value="Show Waiver" \>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@ -309,19 +359,27 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
|||||||
<table>
|
<table>
|
||||||
<tr><td> </td></tr>
|
<tr><td> </td></tr>
|
||||||
<?php
|
<?php
|
||||||
$sql = "SELECT options.option_name AS selection FROM selections, options
|
|
||||||
WHERE selections.selection=options.option_name_id AND
|
if($_GET['contact_id'] != 'new_contact'){
|
||||||
contact_id=" . $row_Recordset1['contact_id'] . ";";
|
$sql = "SELECT options.option_name AS selection FROM selections, options
|
||||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
WHERE selections.selection=options.option_name_id AND
|
||||||
|
contact_id=" . $row_Recordset1['contact_id'] . ";";
|
||||||
|
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
|
}
|
||||||
|
|
||||||
$selections = [];
|
$selections = [];
|
||||||
while ($result = mysql_fetch_assoc($query)) {
|
|
||||||
$selections[$result["selection"]] = $result["selection"];
|
if($_GET['contact_id'] != 'new_contact'){
|
||||||
|
while ($result = mysql_fetch_assoc($query)) {
|
||||||
|
$selections[$result["selection"]] = $result["selection"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = 3;
|
$columns = 3;
|
||||||
$c = 0;
|
$c = 0;
|
||||||
$rows = 0;
|
$rows = 0;
|
||||||
$interest_count = count($volunteer_interests);
|
$interest_count = count($volunteer_interests);
|
||||||
|
|
||||||
while($rows < $interest_count + 3) {
|
while($rows < $interest_count + 3) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
|
|
||||||
@ -344,10 +402,13 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if($volunteer_interest_comments) {
|
<?php if($volunteer_interest_comments) {
|
||||||
$sql = "SELECT selection_value AS comments FROM selections
|
|
||||||
WHERE selection=1 AND contact_id=" . $row_Recordset1['contact_id'] . ";";
|
if($_GET['contact_id'] != 'new_contact'){
|
||||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
$sql = "SELECT selection_value AS comments FROM selections
|
||||||
$result = mysql_fetch_assoc($query);
|
WHERE selection=1 AND contact_id=" . $row_Recordset1['contact_id'] . ";";
|
||||||
|
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||||
|
$result = mysql_fetch_assoc($query);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr><td> </td></tr>
|
<tr><td> </td></tr>
|
||||||
@ -371,7 +432,15 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<input type="hidden" name="MM_insert" value="form1">
|
<input type="hidden" name="MM_insert" value="form1">
|
||||||
<input type="hidden" id="contact_id" name="contact_id" value="<?php echo $row_Recordset1['contact_id']; ?>">
|
<input type="hidden" id="contact_id" name="contact_id"
|
||||||
|
<?php
|
||||||
|
if($_GET['contact_id'] === 'new_contact'){
|
||||||
|
echo "value='new_contact'";
|
||||||
|
} else {
|
||||||
|
echo "value='" . $row_Recordset1['contact_id'] . "'";
|
||||||
|
}
|
||||||
|
?>>
|
||||||
|
<input type="hidden" name="email_list" id="email_list">
|
||||||
<input type="hidden" name="contact_id_entry" value="<?php echo $contact_id_entry; ?>">
|
<input type="hidden" name="contact_id_entry" value="<?php echo $contact_id_entry; ?>">
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -126,6 +126,10 @@ $(function(){
|
|||||||
if (success === "Success") {
|
if (success === "Success") {
|
||||||
|
|
||||||
var email_list = $("#email_list_toggle").val();
|
var email_list = $("#email_list_toggle").val();
|
||||||
|
|
||||||
|
// send email_list val to $_POST
|
||||||
|
$("#email_list").val(email_list);
|
||||||
|
|
||||||
var waiver = waiver_checkbox.prop("checked");
|
var waiver = waiver_checkbox.prop("checked");
|
||||||
if (!email_list) {
|
if (!email_list) {
|
||||||
email_list = 0;
|
email_list = 0;
|
||||||
@ -137,6 +141,9 @@ $(function(){
|
|||||||
} else if (waiver === false) {
|
} else if (waiver === false) {
|
||||||
waiver = 0;
|
waiver = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.post("json/contact.php", {most_recent_contact_id: 1});
|
||||||
|
|
||||||
// update receive_newsletter and waiver in the database
|
// update receive_newsletter and waiver in the database
|
||||||
$.post("json/contact.php", {contact_id: contact_id, email_list: email_list, waiver: waiver });
|
$.post("json/contact.php", {contact_id: contact_id, email_list: email_list, waiver: waiver });
|
||||||
|
|
||||||
@ -254,6 +261,10 @@ $(function(){
|
|||||||
// beginning or stored state
|
// beginning or stored state
|
||||||
$.post("json/contact.php", {contact_id: contact_id, email_list_value: 1 }, function(data) {
|
$.post("json/contact.php", {contact_id: contact_id, email_list_value: 1 }, function(data) {
|
||||||
|
|
||||||
|
if (data === "") {
|
||||||
|
data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$("#email_list_toggle").noUiSlider({
|
$("#email_list_toggle").noUiSlider({
|
||||||
orientation: "horizontal",
|
orientation: "horizontal",
|
||||||
start: data,
|
start: data,
|
||||||
|
@ -7,6 +7,7 @@ $email_list_connector = EMAIL_LIST_CONNECTOR;
|
|||||||
$email_list_connector_password = EMAIL_LIST_CONNECTOR_PASSWORD;
|
$email_list_connector_password = EMAIL_LIST_CONNECTOR_PASSWORD;
|
||||||
$ssl_certificate = SSL_CERTIFICATE;
|
$ssl_certificate = SSL_CERTIFICATE;
|
||||||
|
|
||||||
|
|
||||||
// update waiver
|
// update waiver
|
||||||
if( isset($_POST['waiver']) ) {
|
if( isset($_POST['waiver']) ) {
|
||||||
|
|
||||||
@ -35,7 +36,6 @@ $ssl_certificate = SSL_CERTIFICATE;
|
|||||||
$query = "UPDATE contacts SET receive_newsletter=" . $email_list .
|
$query = "UPDATE contacts SET receive_newsletter=" . $email_list .
|
||||||
" WHERE contact_id=" . $_POST['contact_id'] . ";";
|
" WHERE contact_id=" . $_POST['contact_id'] . ";";
|
||||||
$result = mysql_query($query, $YBDB) or die(mysql_error());
|
$result = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return email_list value
|
// return email_list value
|
||||||
@ -80,5 +80,12 @@ $ssl_certificate = SSL_CERTIFICATE;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['most_recent_contact_id'])) {
|
||||||
|
$query = 'SELECT MAX(contact_id) as contact_id FROM contacts;';
|
||||||
|
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
|
$result = mysql_fetch_assoc($sql);
|
||||||
|
echo $result['contact_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user