Jump to content

[SOLVED] populating an auto_increament attribute


scadran

Recommended Posts

hey guys

I have just designed a BD. there are companies with auto increament which are integer. When I try to populate it after i tool value from another form and try to insert it into a table i recieve an error! I don't ask the companyID value from user as it is auto increament. Don't tell me to put NULL for that entry as it didn't work as well!

 

here are codes:

<?php   
include 'config.php';
$comp_name = $_POST['companname'];
$desc = $_POST['desc'];
$telephoneno = $_POST['tel'];
$own = $_POST['owner'];


   $sql = "INSERT INTO company ( description , telephoneno , owner , compname, compid ) 
           VALUES ($desc, $telephoneno, $own, $comp_name, NULL)";

   $result = mysql_query($sql) 
             or die('Query failed. ' . mysql_error()); 
header('location: panel.php');

?>

 

Any idea what should i do to not recieve Query failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ....

 

Thanks Guys

waiting for ur answers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.