Page 1 of 1

Simple Update dosen't work

Posted: Sun Aug 31, 2008 10:55 am
by arunkar
Hi Experts,

I have a simple update in my PHP that doesn't work. Can you help me spot the err pls:

Code: Select all

        $updateQuery = "Update tbl_contribution_payments Set ContributionPaidOK=1, ContributionTotalAmt='".$amtPaid."',
                        ContributionPaymentRef='".$worldpayref."', ContributionSalesQty=".$salesQty.", ContributionDateTimeStamp=$today4,
                        ContributionPaymentMethod='WP' Where ContributionID=$contributionID AND PartneringID=".$partneringID ." And ContributionJosUserID=".$joomlaid;
echo '<br>updateQuery '.$updateQuery.'<br><br>';
mysql_query(updateQuery);
 
THis is the output Im Getting:

Code: Select all

 
updateQuery Update tbl_contribution_payments Set ContributionPaidOK=1, ContributionTotalAmt='700', ContributionPaymentRef='9830085', ContributionSalesQty=200, ContributionDateTimeStamp=2008-08-31 9:50:11, ContributionPaymentMethod='WP' Where ContributionID=44 AND PartneringID=37 And ContributionJosUserID=460
MySQL DB:

Code: Select all

Field                         Type         Collation          Null    Key     Default  Extra           Privileges                       Comment
----------------------------  -----------  -----------------  ------  ------  -------  --------------  -------------------------------  -------
ContributionID                int(11)      NULL                       PRI     (NULL)   auto_increment  select,insert,update,references         
ContributionJosUserID         int(11)      NULL               YES     MUL     (NULL)                   select,insert,update,references         
ContributionPartnerJosUserID  int(11)      NULL               YES     MUL     (NULL)                   select,insert,update,references         
PartneringID                  int(11)      NULL               YES     MUL     (NULL)                   select,insert,update,references         
ContributionUnitAmt           float(9,2)   NULL               YES             (NULL)                   select,insert,update,references         
ContributionSalesQty          int(11)      NULL               YES             (NULL)                   select,insert,update,references         
ContributionTotalAmt          float(9,2)   NULL               YES             (NULL)                   select,insert,update,references         
ContributionType              char(1)      latin1_swedish_ci  YES             R                        select,insert,update,references         
ContributionDateTimeStamp     datetime     NULL               YES             (NULL)                   select,insert,update,references         
ContributionPaidOK            tinyint(4)   NULL               YES             0                        select,insert,update,references         
ContributionPaymentRef        varchar(10)  latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
ContributionPaymentMethod     char(2)      latin1_swedish_ci  YES             (NULL)                   select,insert,update,references         
 
Help me spot why the table dose'nt get update pls?

Thanks

Re: Simple Update dosen't work

Posted: Sun Aug 31, 2008 11:06 am
by dude81

Code: Select all

  $updateQuery = "Update tbl_contribution_payments Set ContributionPaidOK=1, ContributionTotalAmt='".$amtPaid."',
                         ContributionPaymentRef='".$worldpayref."', ContributionSalesQty=".$salesQty.", ContributionDateTimeStamp=$today4,
                         ContributionPaymentMethod='WP' Where ContributionID=$contributionID AND PartneringID=".$partneringID ." And ContributionJosUserID=".$joomlaid;
 echo '<br>updateQuery '.$updateQuery.'<br><br>';
 mysql_query(updateQuery);
 
1. ContributionDateTimeStamp='$today4'
2.mysql_query(updateQuery); to be mysql_query($updateQuery);

Re: Simple Update dosen't work -- thank you :)

Posted: Sun Aug 31, 2008 10:46 pm
by arunkar
thank you :)