Write a PHP MySQL AppGini Function

This project was successfully completed by pmurugan for $66 CAD in 3 days.

Get free quotes for a project like this
Project Budget
$30 - $250 CAD
Completed In
3 days
Total Bids
Project Description

I have a MySQL database application already in place. Application was built with AppGini

The 2 tables and fields relevant to this project are:

client_id with the fields: status, last_sale, id

sales with the fields; customer (contains [url removed, login to view]), date, time, sale (amount), comments, id

I need to add a function in [url removed, login to view] to update the client_id table when a sales record is added/updated in the sales table. I will call the function in the sales hooks file.

First, the function needs to update the last_sale field (last sale field data formatted to the month, year, and amount of this sales record, as in May 2012 $450 from the sales table)

Then second, to check if [url removed, login to view] is not == "active", then set Status field to Active. I say if status is not == Active because we also have a status of stale. I will be setting the status to stale if a customer has not purchased for 1 year, but if a stale(or any other status) customer makes a new sale, I want to change them to active too.

Info from AppGini website.


Called after executing the update query and before executing the ownership update query. If you open the generated hooks/[url removed, login to view] file in a text editor (where tablename is the name of the concerned table), you can see this function defined as follows:

function tablename_after_update($data, $memberInfo, &$args){

return TRUE;



$data is an associative array where the keys are field names and the values are the field data values that were inserted into the new record. It also includes the item $data['selectedID'] which stores the value of the primary key for the new record.

$memberInfo is an array containing details of the member who signed in. Please refer to memberInfo for more details.

$args is currently not used but is reserved for future uses.

Thanks and I hope this is enough info for now.

Completed by:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online