Simple Update dosen't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arunkar
Forum Commoner
Posts: 50
Joined: Mon Feb 25, 2008 10:37 pm

Simple Update dosen't work

Post 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
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Simple Update dosen't work

Post 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);
arunkar
Forum Commoner
Posts: 50
Joined: Mon Feb 25, 2008 10:37 pm

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

Post by arunkar »

thank you :)
Post Reply