Banging head with an Internal server error

Hi folks,

$query = $db->prepare("INSERT INTO companies('',name,address,city,phone,email,fax,web,type,employees,group_hrm_name,contact_name,contact_mobile)
                       VALUES('',:name,:address,:city,:phone,:email,:fax,:web,:type,:employees,:group_hrm_name,:contact_name,:contact_mobile)");



$query->execute(array(':name' => $name, 
                      ':address' => $address, 
                      ':city' => $city, 
                      ':phone' => $phone,
                      ':email' => $email,
                      ':fax' => $fax,
                      ':web' => $web,
                      ':type' => $type,
                      ':employees' => $employees,
                      ':group_hrm_name' => $group_hrm_name,
                      ':contact_name' => $contact_name,
                      ':contact_mobile' => $contact_mobile));

Note: in above error , add_ajax.js (line 67) is

xmlhttp.send(null);

It’s probably the β€˜β€™ there. You need to supply column names there, not sure what your intententions were with β€˜β€™, but it’s not valid at that point.

That empty two single quotes are for the record id which is an auto increment column

Then you need to put the id column name there (probably id or similar), and not β€˜β€™.

The value can indeed be empty for auto increment, but the column name can not.

1 Like

oooch!! yes, there is a mistake. now i have corrected it :smiley: . But still i am getting the same error.

$query = $db->prepare("INSERT INTO companies(company_id,name,address,city,phone,email,fax,web,type,employees,group_hrm_name,contact_name,contact_mobile)
                       VALUES('',:name,:address,:city,:phone,:email,:fax,:web,:type,:employees,:group_hrm_name,:contact_name,:contact_mobile)");

Thanks ScallioXTX,
you spotted the problem. now problem solved. yes, column name not specifying is the problem.
Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.