我有一個PHP表單,當我將字段留空時,會發生錯誤。離開字段空白時出現PHP格式錯誤
對不起,在重複鍵更新clientID = '45',clientName ='Frank'時將此客戶端sql = insert插入db1.cleints(clientID,clientName)值(45,Frank)時出錯。在你的SQL語法中;檢查對應於你的MySQL服務器版本的手冊,在第1行'clientName'附近使用正確的語法。
更新:我已經包含了代碼是什麼。請忽略這一事實,我的上述只是一個修改的例子。
$sql = "insert into $DB.theater (dsc_id, dsc_lname, dsc_fname, distributor_id, distributor_name, distributor_theater_id, manager_id, manager_name, is_new_theater, name, phone_area, phone_exch, phone_local, phone_ext, street, city, state_prov, country, postal, web_site_url, manager_gender, theater_manager_name, email, location_desc, square_footage, year_founded, colors_techs, stylists, assistants, active_chairs, booth_renters, services, purchase_volume, products, other_lines, other_lines_txt, percent_women, demog_lt_20, demog_lt_35, demog_lt_55, demog_ge_55, avg_sale, avg_cut, avg_color, avg_hilite, rating, can_display, retail_sf, grade, dsc_notes) values ($dsc_id, '$dsc_lname', '$dsc_fname', $distributor_id, '$distributor_name', '$distributor_theater_id', $manager_id, '$manager_name', '$is_new_theater', '$name', '$phone_area', '$phone_exch', '$phone_local', '$phone_ext', '$street', '$city', '$state_prov','$country', '$postal', '$web_site_url', '$manager_gender', '$theater_manager_name', '$email', '$location_desc', '$square_footage', '$year_founded', '$colors_techs', '$stylists', '$assistants', '$active_chairs', '$booth_renters', '$services', '$purchase_volume', '$products', '$other_lines','$other_lines_txt', '$percent_women', '$demog_lt_20', '$demog_lt_35', '$demog_lt_55', '$demog_ge_55', '$avg_sale', '$avg_cut', '$avg_color', '$avg_hilite', '$rating', '$can_display', '$retail_sf', '$grade', '$dsc_notes') on duplicate key update dsc_id=$dsc_id, dsc_lname='$dsc_lname', dsc_fname='$dsc_fname', distributor_id=$distributor_id, distributor_name='$distributor_name', distributor_theater_id='$distributor_theater_id', manager_id=$manager_id, manager_name='$manager_name', is_new_theater='$is_new_theater', name='$name', phone_area='$phone_area', phone_exch='$phone_exch', phone_local='$phone_local', phone_ext='$phone_ext', street='$street', city='$city', state_prov='$state_prov', country='$country', postal='$postal', web_site_url='$web_site_url', manager_gender='$manager_gender', theater_manager_name='$theater_manager_name', email='$email', location_desc='$location_desc', square_footage='$square_footage', year_founded='$year_founded', colors_techs='$colors_techs', stylists='$stylists', assistants='$assistants', active_chairs='$active_chairs', booth_renters='$booth_renters', services='$services', purchase_volume='$purchase_volume', products='$products', other_lines='$other_lines', other_lines_txt='$other_lines_txt', percent_women='$percent_women', demog_lt_20='$demog_lt_20', demog_lt_35='$demog_lt_35', demog_lt_55='$demog_lt_55', demog_ge_55='$demog_ge_55', avg_sale='$avg_sale', avg_cut='$avg_cut', avg_color='$avg_color', avg_hilite='$avg_hilite', rating='$rating', can_display='$can_display', retail_sf='$retail_sf', grade='$grade', dsc_notes='$dsc_notes'";
您需要顯示一些代碼。 – 2011-04-15 17:14:17