Info:
Ubuntu Linux Server / PHP5 / Apache 2.2.12 / MySQL 5.1.37
I am trying to collect user information from a form and POST to the database. Nothing new however, I have an error I cannot seem to isolate and fix. I should mention that I have another page collecting group information crafted in the same manner that works fine. I need some more eyes checking this one. Please help.
A code snip:
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$errors = 0;
// Post data - Master code base for TRC_User table!
$tg_group_id = stripslashes($_POST['group_id']);
$tg_group_code = stripslashes($_POST['group_code']);
$last_name = stripslashes($_POST['last_name']);
$first_name = stripslashes($_POST['first_name']);
$middle_name = stripslashes($_POST['middle_name']);
$suffix_name = stripslashes($_POST['suffix_name']);
$user_name = stripslashes($_POST['user_name']);
$new_password = stripslashes($_POST['password']);
$rdate = stripslashes($_POST['rdate']);
$rtime = stripslashes($_POST['rtime']);
$approved = stripslashes($_POST['approved']);
$preferred_name = stripslashes($_POST['preferred_name']);
$email = stripslashes($_POST['email']);
// $paypal_email = stripslashes($_POST['paypal_email']); - Not Used?
// $signin_date - Check this. Might not be needed.
// $reg_date - Has been changed to $rdate for new login function. Not Needed.
$address1 = stripslashes($_POST['address1']);
$address2 = stripslashes($_POST['address2']);
$city = stripslashes($_POST['city']);
$istate = stripslashes($_POST['istate']);
$izip = stripslashes($_POST['izip']);
$country = stripslashes($_POST['country']);
$state = stripslashes($_POST['state']);
$zip5 = stripslashes($_POST['zip5']);
$zip4 = stripslashes($_POST['zip4']);
$wphone_area = stripslashes($_POST['wphone_area']);
$wphone3 = stripslashes($_POST['wphone3']);
$wphone4 = stripslashes($_POST['wphone4']);
$hphone_area = stripslashes($_POST['hphone_area']);
$hphone3 = stripslashes($_POST['hphone3']);
$hphone4 = stripslashes($_POST['hphone4']);
$birth_month = stripslashes($_POST['birth_month']);
$birth_day = stripslashes($_POST['birth_day']);
$birth_year = stripslashes($_POST['birth_year']);
$person_registering = stripslashes($_POST['person_registering']);
$contact_name = stripslashes($_POST['contact_name']);
$cphone_area = stripslashes($_POST['cphone_area']);
$cphone3 = stripslashes($_POST['cphone3']);
$cphone4 = stripslashes($_POST['cphone4']);
$contact_relation = stripslashes($_POST['contact_relation']);
$air_meals = stripslashes($_POST['air_meals']);
$tour_meals = stripslashes($_POST['tour_meals']);
$allergies = stripslashes($_POST['allergies']);
$land_only = stripslashes($_POST['land_only']);
$single = stripslashes($_POST['single']);
$double = stripslashes($_POST['double']);
$special_needs = stripslashes($_POST['special_needs']);
$skip_passport = stripslashes($_POST['skip_passport']);
$passport_number = stripslashes($_POST['passport_number']);
$iss_month = stripslashes($_POST['iss_month']);
$iss_day = stripslashes($_POST['iss_day']);
$iss_year = stripslashes($_POST['iss_year']);
$exp_month = stripslashes($_POST['exp_month']);
$exp_day = stripslashes($_POST['exp_day']);
$exp_year = stripslashes($_POST['exp_year']);
$p_country = stripslashes($_POST['p_country']);
$p_state = stripslashes($_POST['p_state']);
$insur = stripslashes($_POST['insur']);
$insur_comp = stripslashes($_POST['insur_comp']);
$insur_policy = stripslashes($_POST['insur_policy']);
$add_com = stripslashes($_POST['add_com']);
// $direct_pay - don't think this is needed here.
// $ticket_code
// $ticket_desc
// $pay_deposit_cost
// $pay_deposit_done
//$pay_land_cost
//$pay_air_cost
$exten_commit = stripslashes($_POST['exten_commit']);
//$pay_exten_cost - To be used in admin/edit_user.php.
//$pay_exten_desc - To be used in admin/edit_user.php.
//$pay_extra_cost - To be used in admin/edit_user.php.
//$last_txn_id - Last Transaction ID - To be used for Elavon.
//$cancel - To be used in admin/edit_user.php.
//$cancel_fee - To be used in admin/edit_user.php.
//$refund_date - To be used in admin/edit_user.php.
//$refund_amount - To be used in admin/edit_user.php.
//$deviation - To be used in admin/edit_user.php.
$gender = stripslashes($_POST['gender']);
if ($errors == '0') {
$misserfolg = 0;
// Insert into TRC_User
MYSQL_PCONNECT($myhost, $mydbuser, $mydbpass) OR DIE ("Unable to connect to database");
@mysql_select_db($mydb) or die ("Unable to select database");
$sql = "INSERT INTO TRC_User (
group_id, group_code, last_name, first_name, middle_name, suffix_name, user_name, password, rdate, rtime, approved, preferred_name, email, address1, address2, city, istate, izip, country, state, zip5, zip4, wphone_area, wphone3, wphone4, hphone_area, hphone3, hphone4, birth_month, birth_day, birth_year, person_registering, contact_name, cphone_area, cphone3, cphone4, contact_relation, air_meals, tour_meals, allergies, land_only, single, double, special_needs, skip_passport, iss_month, iss_day, iss_year, exp_month, exp_day, exp_year, p_country, p_state, insur, insur_comp, insur_policy, add_com, exten_commit, gender
) VALUES (
'$tg_group_id', '$sess_group_code', '$last_name', '$first_name', '$middle_name', '$suffix_name', '$user_name', '$password', '$rdate', '$rtime', '$approved', '$preferred_name', '$email', '$address1', '$address2', '$city', '$istate', '$izip', '$country', '$state', '$zip5', '$zip4', '$wphone_area', '$wphone3', '$wphone4', '$hphone_area', '$hphone3', '$hphone4', '$birth_month', '$birth_day', '$birth_year', '$person_registering', '$contact_name', '$cphone_area', '$cphone3', '$cphone4', '$contact_relation', '$air_meals', '$tour_meals', '$allergies', '$land_only', '$single', '$double', '$special_needs', '$skip_passport', '$iss_month', '$iss_day', '$iss_year', '$exp_month', '$exp_day', '$exp_year', '$p_country', '$p_state', '$insur', '$insur_comp', '$insur_policy', '$add_com', '$exten_commit', '$gender')";
$result = @mysql_query($sql);
if(!$result) { die( 'Could not insert data into TRC_User table: ' . mysql_error() ); $misserfolg++; }
if($misserfolg >= '1') {
?>
And the error I'm getting is:
Could not insert data into TRC_User table: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'double, special_needs, skip_passport, iss_month, iss_day, iss_year, exp_month, e' at line 2
I have forgotten the many things I have tried but my approach was to "dumb down" the script to the basics, same error. I have checked for spelling errors between database and script to no avail. I'm stuck. Please help!
Thank you.
rt...