Hi…
I have this code:
$Approved = isset($_POST['priority']);
if ($Approved)
{
$lot_number = $_POST['lot_number'];
$sr_number_ = $_POST['sr_number_'];
$SubQty = $_POST['SubQty'];
$ItemCode = $_POST['ItemCode'];
$picked_by = $_POST['picked_by'];
$sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '$ItemCode' AND lot_number = '$lot_number'";
$res = mysql_query($sql, $con) or die(mysql_error());
$row = mysql_fetch_assoc($res);
$stock_item = $row['stock_item'];
$qty = $row['qty'];
if($qty >= $SubQty){
$output = $qty - $SubQty;
$qty_withdraw = '0.00';
}
else{
$output = '0.00';
$qty_withdraw = $SubQty - $qty;
}
}
error:
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 ‘MAT-CHE-0040’’ at line 2
but when I echo the $sql;
the output is:
SELECT stock_item, qty FROM wms WHERE stock_item = ‘MAT-CHE-0040’ AND lot_number = ‘LO120601002’;
and it works.
I don’t know why in php the sql query got an error:
How can I remove that error?
Thank you so much