This topic is locked

How to get max value from field in db

6/19/2018 2:18:13 PM
PHPRunner General questions
B
beishmc author

Hello,

in database i have fields "start_mile" and "end_mile" that user enters values from phprunner 9.0 add form.
To explain better:

  1. I have car that is used everyday and every day i enter start mile and finish mile (path traversed) in database.
  2. Next time i also entering start mile and finish mile for that day, so far i enter last finish mile manualy and wonder if there is the way that i could get the value from last entered finish mile for the car in question.
    I want to set default value of the "start_mile" field to be the last maximum value from "end_mile" field for car that i'm adding in db "select max(end_mile) from path where car_id = " how to pass car_id in this select?
    Thanks