Is it possible to execute functions created in the PostgreSQL database engine through my PHP query?...
It is clear to me that the triggers are executed as soon as you make changes to the tables in your DB, however, I am still wondering if it is possible to do the following:
I have the sum() function created in the PostgreSQL engine
create or Replace function suma(num1 integer, num2 integer) returns integer
as
$$
select num1 + num2;
$$
Language SQL;
what I try to do is in my code editor and with PHP the following:
$num1 = (isset($_POST['num1'])) ? $_POST['num1']:"";
$num2 = (isset($_POST['num2'])) ? $_POST['num2']:"";
$suma = pg_query($conn,"SELECT suma($num1,$num2)"); <-- aqui llamo la función suma de postgresql
echo $suma;
before being able to enter the variables it is throwing me an error:
Warning: pg_query(): Query failed: ERROR: syntax error at or near "," LINE 1: SELECT sum(,) ^ in C:\xampp\htdocs\moca\sections\image.php on line 49