3TAJIOH Posted January 24, 2019 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 73 Reputation: 1 Joined: 11/27/18 Last Seen: August 4, 2024 Share Posted January 24, 2019 (edited) public function depositCredits($targetAccountID, $credits, $donationAmount = null) { $sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?"; $sth = $this->connection->getStatement($sql); if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) { return false; // Account doesn't exist. } $creditsTable = Flux::config('FluxTables.CreditsTable'); $cashesTable = Flux::config('FluxTables.CashTable'); if (!$this->hasCreditsRecord($targetAccountID)) { $fields = 'account_id, balance'; $values = '?, ?'; if (!is_null($donationAmount)) { $fields .= ', last_donation_date, last_donation_amount'; $values .= ', NOW(), ?'; } $sql = "INSERT INTO {$this->loginDatabase}.$creditsTable ($fields) VALUES ($values)"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, $credits); if (!is_null($donationAmount)) { $vals[] = $donationAmount; } return $sth->execute($vals); } else { $vals = array(); $sql = "UPDATE {$this->loginDatabase}.$cashesTable SET value = value + ? "; $vals[] = $credits; if (!is_null($donationAmount)) { $vals[] = $donationAmount; } $vals[] = $targetAccountID; $sql .= "WHERE account_id = ?"; $sth = $this->connection->getStatement($sql); return $sth->execute($vals); } } FluxCP cannot edit table acc_reg_num? Donation to cp_credits works normally. Edited January 24, 2019 by 3TAJIOH Link to comment Share on other sites More sharing options...
0 crazyarashi Posted January 24, 2019 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: 2 hours ago Share Posted January 24, 2019 So what should we exactly should we do with the function you provided again? Link to comment Share on other sites More sharing options...
0 3TAJIOH Posted January 24, 2019 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 73 Reputation: 1 Joined: 11/27/18 Last Seen: August 4, 2024 Author Share Posted January 24, 2019 4 minutes ago, crazyarashi said: So what should we exactly should we do with the function you provided again? Updated. I want to make donation to CashPoints, not to Credit Points. Link to comment Share on other sites More sharing options...
Question
3TAJIOH
FluxCP cannot edit table acc_reg_num? Donation to cp_credits works normally.
Edited by 3TAJIOHLink to comment
Share on other sites
2 answers to this question
Recommended Posts