I am using it to do with PHP. 

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 '' at line 1`

**EDIT 1:**

```
$SQLQUERY = sprintf("SELECT pd_serial FROM product_details WHERE pd_model_type=%s AND pd_model_name=%s AND pd_model_version=%s AND pd_product_group=%s LIMIT 1",
GetSQLValueString($modeltype, "text"),
GetSQLValueString($modelname, "text"),
GetSQLValueString($modelversion, "text"),
GetSQLValueString($modelgroup, "text"));
$QUERYEXEC =  mysql_query($SQLQUERY, $dacreint) or die("OOPS! Please try again.");

while ($QUERYFETCH = mysql_fetch_array($QUERYEXEC))
{
    $pdserial = $QUERYFETCH['pd_serial'];
}

```

**EDIT 2:**

```
while ($QUERYFETCH = mysql_fetch_array($QUERYEXEC))
{
    $pdserial = $QUERYFETCH['pd_serial'];
}
$SQLQUERY = sprintf("SELECT product_serial_no FROM products WHERE product_serial_no = '$product_serial_no'");
$TCcount_QE = mysql_query($SQLQUERY, $dacreint) or die(mysql_error());

```