robertdown wrote on Thursday, August 25, 2016:
This could be written more efficiently:
$result = sqlQuery("SELECT id AS pid FROM patient_data ORDER BY id DESC LIMIT 1");
$newpid = ($result['pid'] > 1) ? $result['pid'] + 1 : 1;
This condenses the if statement down to 1 line without using irregular if statements and unnecessary variable declarations.