日期:2014-11-26 分類:網(wǎng)絡(luò)技術(shù) 瀏覽:10072 來源:邦明科技
用echo $sql;輸出SQL語句,下面代碼沒錯(cuò),但就是無法執(zhí)行也沒報(bào)錯(cuò):
insert into xmoa_customer (customerid,contactname,gender,company,birthday,country,staff,staffusername,sortpath,customertype,customerfrom,customerstate,website,address,qqmsn,zipcode,mobile,email,telephone,fax,account,bank,accountname,beizhu,addtime,level,customerlevel,addyear,addmonth) values ('customerlevel','customerlevel','男士','customerlevel','2014-09-28','customerlevel','符工','info@bmkj.net','0,1,','銀牌客戶','網(wǎng)絡(luò)廣告','潛在客戶','','','','','','','','','','','','','2014-09-28 11:46:42','2147483647','30','2014','9')
原因是某個(gè)字段,如:password不能為空,卻在SQL語句沒有賦值
使用:
$result=mysql_query($sql) or die( mysql_error() );
發(fā)現(xiàn)原因是:Field 'password' doesn't have a default value
PHP INSERT語句沒執(zhí)行也沒報(bào)錯(cuò)的解決方法:給該字段password賦值或者修改該段允許為空。