Jump to content

MySQL server version for the right syntax to use near ')' at line 1


Recommended Posts

Hi guys,

 

The full error message when trying to access  /success.php is:

 

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

 

Actually, I'm working on an open source script with already installed Paypal IPN. However, since Paypal isn't functioning in my country, I decided to change a command in the purchase.php file from

 

<form name="purchase_form" id="purchase_form" method="post" action="<?php echo DOCROOT; ?>modules/payment/paypal.php">

 

to

 

<form name="purchase_form" id="purchase_form" method="post" action="<?php echo DOCROOT; ?>modules/payment/success.php">

 

Below is the Success.php file.

 

<?php

ob_start();

session_start();

include($_SERVER['DOCUMENT_ROOT'].'/includes/library.inc.php');

 

if($_SESSION['userid']=="")

{

set_response_mes(-1,"Please login to further Process");

url_redirect(DOCROOT);

}

 

if($_SESSION['userid']!="")

{

//print_r($_SESSION['coopon_pay_id']);

$coopon_pay_id = $_SESSION['coopon_pay_id'];

//print_r($coopon_pay_id);

 

//change the coupon status while coupon reaches its max count

$ccode = $_SESSION['cid'];

$purchased_ccount = getMembersCount($ccode);

$limit = getCouponUsersLimit($ccode);

if($purchased_ccount == $limit['max']){

$query = "update coupons_coupons set coupon_status ='E' where coupon_id='$ccode'";

$result = mysql_query($query) or die(mysql_error());

}

 

 

  $count = count($coopon_pay_id) ;

  $value ='';

  for($i=0;$i<$count;$i++)

  {

    $val = $_SESSION['coopon_pay_id'][$i];

    $value.= $val.',';

  }

 

$value = substr($value,0,strlen($value)-1);

 

mysql_query("update coupons_purchase set Coupon_amount_Status='T' where coupon_purchaseid in ($value) ") or die(mysql_error());

 

$_SESSION['savedamt'] = $tot_savedamt = $_SESSION['tot_savedamt']; //update total saved amt to user saved amt

$tot_cquantity = $_SESSION['tot_cquantity'];

 

mysql_query("update coupons_purchase_status set coupons_purchased_count=coupons_purchased_count+$tot_cquantity, coupons_amtsaved=coupons_amtsaved+$tot_savedamt where id='1' ") or die(mysql_error());

 

$userid = $_SESSION["userid"];

 

//clear the session variables

$_SESSION['coopon_pay_id'] = '';

$_SESSION['tot_savedamt'] = '';

$_SESSION['tot_cquantity'] = '';

$_SESSION['deductable_amt'] = '';

$_SESSION['cid'] = '';

 

set_response_mes(1, "Your Payment has been Successfully Completed.");

url_redirect(DOCROOT."profile.html");

 

}

ob_flush();

?>

 

Thanks everyone

Link to comment
Share on other sites

$value is probably empty. "IN ()" is not valid - there have to be some values in there.

 

One of these is correct and one is wrong:

- Add conditional logic to only execute stuff if there are values

- Change the code to find whatever it needs in the correct location (as apparently it isn't in the session)

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.