Jump to content

syafia

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

syafia's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok..i got the solution at last. Thanks for realizing me that something going wrong with my db table. I've alter back my db table and got the solution to update the balance table. Tq, all helps are appreaciated
  2. hye! Im a newbie in MySQL and Php, i got a problem to update column in db. Here is the issue: i have 2 tables named 'apply' and 'balance'. Table: apply userId leaveType daysApply 1 Annual 3 2 Medical 1 Table: balance userId Annual Medical 1 14 3 2 14 3 When user apply for leave, the system will deduct the value from table:balance based on apply.leaveType = balance.@column name. My problem is i dont know how to update the column value based on the apply.leaveType value from other table. i try to do this but it doesnt make sense: $result=mysql_query(UPDATE `balance`, `apply` SET `balance.Annual`=`balance.Annual`-`apply.daysApply`, `balance.Medical`=`balance.Medical`-`apply.daysApply` WHERE `balance.Annual`=`apply.leaveType` AND `balance.Medical`=`apply.leaveType` AND `balance.userId`=`apply.userId`); Hope someone can help me. Any helps are appreciated. [attachment deleted by admin]
×
×
  • 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.