$sql = "INSERT INTO cal_info \n";
$sql .= "( cal_id, ans_patient, ans_patient_csi, ans_patient_sum, ans_nurse, ans_nurse_csi, ans_nurse_sum, \n";
$sql .= "ans_pick, ans_pick_csi, ans_pick_sum, gen_m, gen_m_csi, gen_m_sum, gen_w, \n";
$sql .= "gen_w_csi, gen_w_sum, age_rang1, age_rang1_csi, age_rang1_sum, age_rang2, \n";
$sql .= "age_rang2_csi, age_rang2_sum, age_rang3, age_rang3_csi, age_rang3_sum, age_rang4, age_rang4_csi, age_rang4_sum, \n";
$sql .= "age_rang5, age_rang5_csi, age_rang5_sum, edu_primary, edu_primary_csi, edu_primary_sum, edu_high, \n";
$sql .= "edu_high_csi, edu_high_sum, edu_bachelor, edu_bachelor_csi, edu_bachelor_sum, cash_money, cash_money_csi, cash_money_sum, \n";
$sql .= "cash_tack, cash_tack_csi, cash_tack_sum, first_first, first_first_csi, first_first_sum, first_more, \n";
$sql .= "first_more_csi, first_more_sum, like1, like2, like3, like4,\n";
$sql .= "like5, like6, like7, like_sumary, like_no, \n";
$sql .= "com1_yes, com1_no, com2_yes, com2_no, \n";
$sql .= "com3_yes, com3_no, paper_sum, \n";
$sql .= "ans_patient_5, ans_nurse_5, ans_pick_5, gen_m_5, gen_w_5, \n";
$sql .= "age_rang1_5, age_rang2_5, age_rang3_5, age_rang4_5, age_rang5_5, \n";
$sql .= "edu_primary_5, edu_high_5, edu_bachelor_5, cash_money_5, cash_tack_5, \n";
$sql .= "first_first_5, first_more_5 \n";
$sql .= " ) \n";
$sql .= "VALUES \n ";
$sql .= "('$cal_id', '$ans[0]', '$ans_patient_csi', '$ans_patient_sum', '$ans[1]', '$ans_nurse_csi', '$ans_nurse_sum', \n ";
$sql .= " '$ans[2]', '$ans_pick_csi', '$ans_pick_sum', '$gen[0]', '$gen_m_csi', '$gen_m_sum', '$gen[1]', \n ";
$sql .= " '$gen_w_csi', '$gen_w_sum', '$age[0]', '$age_rang1_csi', '$age1_sum', '$age[1]', \n ";
$sql .= " '$age_rang2_csi', '$age2_sum', '$age[2]', '$age_rang3_csi', '$age3_sum', '$age[3]', '$age_rang4_csi', '$age4_sum', \n ";
$sql .= " '$age[4]', '$age_rang5_csi', '$age5_sum', '$edu[0]', '$edu_primary_csi', '$edu_primary_sum', '$edu[1]', \n ";
$sql .= " '$edu_high_csi', '$edu_high_sum', '$edu[2]', '$edu_bachelor_csi', '$edu_bachelor_sum', '$cash[0]', '$cash_money_csi', '$cash_money_sum', \n ";
$sql .= " '$cash[1]', '$cash_tack_csi', '$cash_tack_sum', '$first[0]', '$first_first_csi', '$first_first_sum', '$first[1]', \n ";
$sql .= " '$first_more_csi', '$first_more_sum', '$likeans[1]', '$likeans[2]', '$likeans[3]', '$likeans[4]', \n ";
$sql .= " '$likeans[5]', '$likeans[6]', '$likeans[7]', '$sumlike', '$like_no', \n ";
$sql .= " '$com1[0]', '$com1[1]', '$com2[0]', '$com2[1]', \n ";
$sql .= " '$com3[0]', '$com3[1]', '$sumpaper', \n";
$sql .= " '$ans_patient[5]', '$ans_nurse[5]', '$ans_pick[5]', '$gen_m[5]', '$gen_w[5]', \n ";
$sql .= " '$age1[5]', '$age2[5]', '$age3[5]', '$age4[5]', '$age5[5]', \n ";
$sql .= " '$edu_primary[5]', '$edu_high[5]', '$edu_bachelor[5]', '$cash_money[5]', '$cash_tack[5]', \n ";
$sql .= " '$first_first[5]', '$first_more[5]' \n ";
$sql .= " ); \n ";
mysql_query($sql)or die("<pre>$sql</pre>".mysql_error());
อยากรู้ว่าแต่ละท่านจัดการ การเขียน sql กับ php ยังไง ไม่ให้ตาลายครับ
เลยอยากทราบว่า แต่ละท่านจัดบรรทัดกันยังไงครับ
ผมเขียนแบบนี้ ซึ่งตาลายมากครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้