I am inserting some data with below code but not getting inserted. I have checked every thing by echo $_REQUEST
data everything is fine in output but doesn't insert data
With this code. I am Grabbing the data from the form
$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'];
It gets echo easily with this
echo "$bname, $btype, $bemail, $bwebsite, $bphone, $bpostal, $bcountry, $bannertype,
$bgcolor, $bheadcolor,$bsubheadcolor,$btextcolor";
but when it comes to insertion doesnt work gives error
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';*/
this is my table description
+----------------------------+---------------+------+-----+---------+-----------
-----+
| 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 |
".mysql_error()); and post the output here and also echo your sql and paste here – Minesh Feb 11 '13 at 12:47