This topic is locked
[SOLVED]

 Correct Syntax

7/17/2019 12:11:17 PM
PHPRunner General questions
P
PaulM author

I've created a button and want to insert into a table various values from different tables. I can assign values to variables without any problem but when I try to do a DBLookup using that variable, it doesn't return anything. I'm sure its my syntax but no matter what I try I can't get it to work
$record = $button->getCurrentRecord();

$resultDetail["MD_id"]=$record["MD_id"];
$sql = DB::PrepareSQL("select MD_work_done from Maintenance_Details where (MD_id = '".$resultDetail["MD_id"]."')");

$maintenance_workdone=DBLookup($sql);

admin 7/17/2019

You need to print this SQL query to see if it looks right. That would be the first troubleshooting step.
https://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm

P
PaulM author 7/17/2019



You need to print this SQL query to see if it looks right. That would be the first troubleshooting step.
https://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm


Thanks Sergey,
I've tried just about all the combinations I can think of to get it to work including those in the document suggested but unfortunately I still can't get it working. Any other tips?

P
PaulM author 7/19/2019



Thanks Sergey,
I've tried just about all the combinations I can think of to get it to work including those in the document suggested but unfortunately I still can't get it working. Any other tips?


My Findings:
When doing a DBLookup the column needs to be in double quotes ie: .$resultDetails["MD_id"]

when doing an insert the variable needs to be in single quotes ie: ('$workdone')