How to execute PHP Method from a Form Event?

I am currently trying out ScriptCase, but REALLY LIKE it. Very powerful!

I have a PHP method that I want to call which executes a SQL Stored Procedure to return a record count from a table. Not sure where to place the code which will call the PHP function “fncrecipeheadercount”.

I want to call the function and return the value representing the number of rows in the selected table. Then I will add one to that value for the current record I am on.
<?php
function info()
{
$stmt = $dbh->prepare(“CALL stproc_tblrecipeheadercount(?)”);
$stmt->bindParam(1, $return_value, PDO::PARAM_STR, 4000);
$stmt->execute();
print "procedure returned $return_value
";
}
?>

Would the above PHP code be correct (for MySQL connection already open? Where (what area) in Form do I place a call to this function? 1) Fields, Events or AJAX evenbts?

Thank you for all of your help.