error in your SQL syntax........near '' at line 1
i have payment success page should update database when payment correct getting error
you have error in sql syntax; check manual corresponds mysql server version for right syntax use near '' @ line 1
on success.php page, have looked @ code cant seem see error, have changed ' ' "" on line 1 didn't hoping , see incorrect syntax
<?php require_once('connections/chic.php'); ?>
<?php
// *** update stock ***
$details_table = "chicjewls_orderdetails";
$id_column = "uniqueid";
$details_prodid = "productid";
$details_qty = "quantity";
$xstock_tablename = "chicjewls_products";
$xstock_fieldname = "stock";
$xstock_unid = "productid";
if (!session_id()) session_start();
if (isset($_session["orderid"])) {
mysql_select_db($database_chic, $chic);
$details_source = "select * " . $details_table . " " . $id_column . " = " . $_session["orderid"];
$detailsrs = mysql_query($details_source, $chic) or die(mysql_error());
$row_detailsrs = mysql_fetch_assoc($detailsrs);
do {
$xstock_qtysource = "select " . $xstock_fieldname . " " . $xstock_tablename . " " . $xstock_unid . " = " .$row_detailsrs[$details_prodid] . "";
$xstock_rsupd = mysql_query($xstock_qtysource, $chic) or die(mysql_error());
$row_xstock_rsupd = mysql_fetch_assoc($xstock_rsupd);
if ($row_xstock_rsupd[$xstock_fieldname] > 0) {
$xstock_new = $row_xstock_rsupd[$xstock_fieldname] - $row_detailsrs[$details_qty];
if ($xstock_new < 0) $xstock_new = 0;
$xstock_updsource = "update " . $xstock_tablename . " set " . $xstock_fieldname . " = " . $xstock_new . " " . $xstock_unid . " = " .$row_detailsrs[$details_prodid] . "";
$xstock_rsupd = mysql_query($xstock_updsource, $chic) or die(mysql_error());
}
} while ($row_detailsrs = mysql_fetch_assoc($detailsrs));
$xstock_rsupd = null;
$detailsrs = null;
session_unregister("orderid");
}
?>
thanks in advance
>.$row_detailsrs[$details_prodid] . ""
i'n not sure think dot operator needs space before , after. missing space after dot in 2 locations in script.
More discussions in Develop server-side applications in Dreamweaver
adobe
Comments
Post a Comment