Jump to content

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.