Jump to content

Query


june_c21

Recommended Posts

hi , can someone tell me what 's wrong with this query ?

 

INSERT INTO out( name , section , wo , printer_name , toner_code , quantity , remarks , technician , trainee ) VALUES ('$name','$section','$wo','$printer_name','$toner_code','$quantity', '$remarks','$technician','$trainee')

 

thanks

Link to comment
Share on other sites

As joel is saying above, you need to provide more information, show the php code where this query is run.

 

Also, make sure you have a value going into every column of your database table. I counted 9 entries from this query, is there exactly 9 columns in your database table?

 

Denno

Link to comment
Share on other sites

here is my code

 

<?php
include './includes/header.php';

$id = $_GET ['id'];
$names = $_POST ['names'];
$section = $_POST ['section'];
$wo = $_POST ['wo'];
$printer_name = $_POST ['printer_name'];
$toner_code = $_POST ['toner_code'];
$quantity = $_POST ['quantity'];
$remarks = $_POST ['remarks'];
$technician = $_POST ['technician'];
$trainee = $_POST ['trainee'];

$query= "INSERT INTO out( names , section , wo , printer_name , toner_code , quantity , remarks , technician , trainee ) VALUES ('$names','$section','$wo','$printer_name','$toner_code','$quantity', '$remarks','$technician','$trainee') ";
$result = mysql_query($query,$dblink);

$query= "UPDATE master SET qty= qty - $quantity WHERE id= $id";
$result = mysql_query($query,$dblink );

  
  echo "Inventory Successfully Saved. ";
?>

 

the error i get is

 

#1064 - 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 'out( names , section , wo , printer_name , toner_code , quantity , remarks , tec' at line 1

Link to comment
Share on other sites

INSERT INTO out( names , section , wo , printer_name , toner_code , quantity , remarks , technician , trainee ) VALUES ('$names','$section','$wo','$printer_name','$toner_code','$quantity', '$remarks','$technician','$trainee')

 

I don't think you need to have the information in the brackets after INSERT INTO out.

 

Take out that and see what happens.

 

Denno

Link to comment
Share on other sites

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.