mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2026-09-03 02:11:38 -04: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:
+10
-3
@@ -7,6 +7,7 @@ $email_list_connector = EMAIL_LIST_CONNECTOR;
|
||||
$email_list_connector_password = EMAIL_LIST_CONNECTOR_PASSWORD;
|
||||
$ssl_certificate = SSL_CERTIFICATE;
|
||||
|
||||
|
||||
// update waiver
|
||||
if( isset($_POST['waiver']) ) {
|
||||
|
||||
@@ -30,12 +31,11 @@ $ssl_certificate = SSL_CERTIFICATE;
|
||||
|
||||
// update email_list
|
||||
if( isset($_POST['email_list']) ) {
|
||||
|
||||
|
||||
$email_list = $_POST['email_list'];
|
||||
$query = "UPDATE contacts SET receive_newsletter=" . $email_list .
|
||||
" 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
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user