This topic is locked

Auto Fill A Field With The Latest Release In The Database

5/11/2013 8:26:48 AM
PHPRunner General questions
J
joiresende author

I have the following table:

id

number

currentbalance

previous
balance
For example if you want to automatically fill in the number field, I use the maximum ID value +1: as below

{

$ rs = CustomQuery ("select max (". AddFieldWrappers ("Number"). ") from the max_number". AddTableWrappers ("caixa"));

db_fetch_array $ data = ($ rs);

if ($ data) {

$ values ​​['number'] = $ data ['max_number'] + 1;

}
How would I auto populate the field current_balance with the last release. Because I am not using the maximum and minimum value for the field value is variable.
Sorry for my English

João

J
joiresende author 5/17/2013

anyone have any idea?

Sergey Kornilov admin 5/17/2013

Sorry, it's hard to understand what your question is.
Are you saying this code is not working?

J
joiresende author 5/17/2013

This code works perfectly.
I need to look in the database since the last added in a certain field on a table. I can not use maximum and minimum as this data is variable.