我正在使用以下代码插入一些数据,但没有插入。我已经通过回显$_REQUEST
数据检查了所有内容,输出中一切正常,但没有插入数据
有了这个代码。我正在从表单中获取数据
$bname =$_REQUEST['bname'];
$btype =$_REQUEST['btype'];
$bemail =$_REQUEST['bemail'];
$bwebsite =$_REQUEST['bwebsite'];
$bphone =$_REQUEST['bphone'];
$bpostal =$_REQUEST['bpostal'];
$bcountry =$_REQUEST['bcountry'];
$bannertype =$_REQUEST['bannertype'];
$bgcolor =$_REQUEST['bgcolor'];
$bheadcolor =$_REQUEST['bheadcolor'];
$bsubheadcolor =$_REQUEST['bsubheadcolor'];
$btextcolor =$_REQUEST['btextcolor'];
它很容易得到回声
echo "$bname, $btype, $bemail, $bwebsite, $bphone, $bpostal, $bcountry, $bannertype,
$bgcolor, $bheadcolor,$bsubheadcolor,$btextcolor";
但是当涉及到插入不起作用时会出错
include 'dbconnect.php';
$sql="insert into company (business_id, business_name, business_type, bunsiness_email,
business_website, work_phone, postal_code, business_country,banner_type,
select_bgcolor, select_heading1, select_heading2, select_text) values
('NULL','".$bname."','".$btype."','".$bemail."','".$bwebsite."', '".$bphone."',
'".$bpostal."', '".$bcountry."','".$bannertype."', '".$bgcolor."', '".$bheadcolor."',
'".$bsubheadcolor."', '".$btextcolor."')";
mysql_query($sql) or die("An Error Occured while updating");
include 'dbclose.php';*/
这是我的表描述
+----------------------------+---------------+------+-----+---------+-----------
-----+
| Field | Type | Null | Key | Default | Extra
|
+----------------------------+---------------+------+-----+---------+-----------
-----+
| business_id | int(10) | NO | PRI | NULL | auto_increment |
| business_name | varchar(50) | NO | | NULL ||
| business_type | varchar(50) | NO | | NULL | |
| business_email | varchar(50) | NO | | NULL |
| business_website | varchar(50) | NO | | NULL |
| work_phone | varchar(20) | NO | | NULL |
| postal_code | varchar(20) | NO | | NULL |
| business_country | varchar(20) | NO | | NULL |
| banner_type | varchar(50) | NO | | NULL |
| select_bgcolor | varchar(50) | NO | | NULL |
| select_heading1 | varchar(50) | NO | | NULL |
| select_heading2 | varchar(50) | NO | | NULL |
| select_text | varchar(50) | NO | | NULL |