This topic is locked
[SOLVED]

 Check if record exist Error

1/2/2015 4:54:33 PM
PHPRunner General questions
bobdutil author

I added this in the "Add Page", Before record added event.
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from driver_trip_tbl where drv_trp_date ='". toPHPTime($values["drv_trp_date"]) ."' AND drv_id ='". $values["drv_id"] ."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

$message = "The Payroll Week already Exits for this driver."

return false;

}

else

{

return true;

}
//**
I keep getting "Parse error: syntax error, unexpected 'return' (T_RETURN) in driver_trip_tbl_events.php on line 179"
Can anyone see what's I'm missing? I'm probably going to kick myself once we figure this out.

Sergey Kornilov admin 1/2/2015

Run Syntax check in PHPRunner Event Editor - it can point you in the right direction.

bobdutil author 1/3/2015

I corrected the following:
OLD
{

$message = "The Payroll Week already Exits for this driver."

return false;

}
NEW (removed the return false; and place semi-colon at the end of the message.)
{

$message = "The Payroll Week already Exits for this driver.";

}