Hi,

i am trying to get my table updated with "Worldpay callback parameters" and struggling.

Here is what I'm trying to do.

I have a table named "users"
in that table I need to update a field called "status" with a value posted back by worldpay:

$HTTP_POST_VARS['transStatus']

w

ith my WHERE condition being that my users table column "Uid" =

$HTTP_POST_VARS['cartId'] 

(which is another value returned by worlpay server.)
I have tried all sorts and can't seem to get the syntax right or my table updated

Could you help please?

thanks,

Vinny

    So what is your code that you've tried?

      Thanks 4 reply,

      ok, I know this is wrong...

        mysql_select_db($database_to_octo, $to_octo);
      
      
      $query = "UPDATE user SET transStatus = '$HTTP_POST_VARS['transStatus']' . WHERE user = '$HTTP_POST_VARS['cartId']'";
      
      mysql_query($query) ; 
        $query = "UPDATE user SET status = '$HTTP_POST_VARS['transStatus']' . WHERE Uid = '$HTTP_POST_VARS['cartId']'"; 

          yes i see my basic errors, but using your code I get the error:

          Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/vhosts/eggmeg.com/httpdocs/callback.php on line 18

          (Line 18 being your line)

          I know these values are being returned alright as I can echo them on the page

            $query = "UPDATE user SET status = '".$HTTP_POST_VARS['transStatus']."' . WHERE Uid = '".$HTTP_POST_VARS['cartId']."'"; 

              thank you, it is not quite working but for another reason I think .
              I'll keep trying
              thanks.

                no more errors.
                just not updating.
                I'm trying to find out why/

                I have tried entering a text value for $status and deleted the where condition and my $value was updated fine.

                However I have created

                $transtatusField = $HTTP_POST_VARS['transStatus'];
                $cartID = $HTTP_POST_VARS['cartId'];

                and echo:

                                        <td><?php echo "$transtatusField" ?>&nbsp;</td>
                
                                        <td><?php echo " $cartID" ?></td>

                and both value do display fine,

                so maybe I shoud tupdate my query using status = $transtatusField where Uid =$cartID ??

                thats what I was about to try. is the syntax different? or do I just replace the HHT_POST with the $?

                  If $HTTP_POST_VARS['foo'] is blank, but $foo isn't, then you have a problem with your design --- not a big one, necessarily. It's simply that the vars are not being POSTed to the page upon which you are calling them.

                  If $foo works, though, then your server must be set with register_globals enabled, which is generally considered to be a rather large security risk.

                  As for the question, "is the syntax different", the answer is, it can be, but doesn't have to be, so try it either way.

                    I have tried a few things, this one not giving me an error, but not working wither.

                    should it say "echo" and then the $?

                    $query = "UPDATE users SET transStatus = '".$transtatusField."' . WHERE Uid = '".$cartID."'"; 

                      add:

                      or die(mysql_error());

                      to the mysql_query() call

                        Grrr!

                        nearly there, it still has a problem of syntax but at least I know my values are being printed as I get the message:

                        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 '. WHERE Uid = '1'' at line 1

                        1 being the correct cartID number I am trying to retrieve at the other end.

                        My full query is now:

                          mysql_select_db($database_to_octo, $to_octo);
                        $query_rsusers1 = "UPDATE users SET transStatus = '".$transtatusField."' . WHERE Uid = '".$cartID."'"; 
                        mysql_query($query_rsusers1) or die(mysql_error());

                        Thanks again.

                          ok, got it now.
                          it just didn't like the . before WHERE

                          many thanks for the help

                          Vinny

                            Write a Reply...