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

Brings back date_created in contacts after inadvertently removing it when improving contact creation. Originally, this code

$insertSQL = sprintf("INSERT INTO contacts (date_created) VALUES (%s)",
						   GetSQLValueString('current_time', "date"));

instantly created a contact, which was very annoying.
This commit is contained in:
Jonathan Rosenbaum 2015-11-30 23:20:41 +00:00
parent a303522b1a
commit 5737b195f9

View File

@ -102,11 +102,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$query = 'SELECT MAX(contact_id) as contact_id FROM contacts;'; $query = 'SELECT MAX(contact_id) as contact_id FROM contacts;';
$sql = mysql_query($query, $YBDB) or die(mysql_error()); $sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql); $result = mysql_fetch_assoc($sql);
$submitted_contact_id = $result['contact_id'] + 1; $submitted_contact_id = $result['contact_id'] + 1;
$current_date_time = GetSQLValueString('current_time', "date");
// Insert new contact information into a new record // Insert new contact information into a new record
$updateSQL = 'INSERT INTO contacts (contact_id, first_name, middle_initial, last_name, email,' . $updateSQL = 'INSERT INTO contacts (contact_id, first_name, middle_initial, last_name, email,' .
' phone, address1, address2, city, state, DOB, receive_newsletter, waiver, pass, zip)' . ' phone, address1, address2, city, state, DOB, receive_newsletter, waiver, pass, zip, date_created)' .
' VALUES (' . ' VALUES (' .
$submitted_contact_id . ', ' . $submitted_contact_id . ', ' .
'"' . $_POST['first_name'] . '", ' . '"' . $_POST['first_name'] . '", ' .
@ -122,7 +123,8 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
'"' . $_POST['email_list'] . '", ' . '"' . $_POST['email_list'] . '", ' .
1 . ', ' . 1 . ', ' .
'ENCODE("' . $_POST['password'] . '",' . '"yblcatx"), ' . 'ENCODE("' . $_POST['password'] . '",' . '"yblcatx"), ' .
'"' . $_POST['zip'] . '");'; '"' . $_POST['zip'] . '", ' .
$current_date_time . ');';
} else { } else {
// Update existing contact record // Update existing contact record