C
|
cgphp 10/11/2011 |
In the "Before record added" event, enter this code: $rs = CustomQuery("SELECT MAX(id), mileage_current FROM mileage_table_name");
|
B
|
bilboss author 10/13/2011 |
thanks christian, but I do not work at all. |
C
|
cgphp 10/13/2011 |
I'm not sure I understand what you want to do. |
B
|
bilboss author 10/13/2011 |
I need to create a record for vehicle fuel efficiency, so NEED that each vehicle code will automatically add previous mileage when entering a new record, nose if I explained well, greetings |
C
|
cgphp 10/13/2011 |
The code above should solve your issue. The query needs a WHERE clause to filter the records that match the new vehicle code you are adding: $rs = CustomQuery("SELECT MAX(id), mileage_current_field_name FROM mileage_table_name WHERE vehicle_code_field_name='".$values['vehicle_code_field_name']."'");
|
B
|
bilboss author 10/14/2011 |
hello cristian code works for me, but returns the data from the first record of the vehicle code or not the last, and to provide with MIN(id) and neither worked, have any idea how to solve this problem, |
C
|
cgphp 10/15/2011 |
What are the fields names of the table ? |
B
|
bilboss author 10/15/2011 |
id / vehicle_Cod / Mileage_previous / current_mileage / |