Hello, I was using this code in PHP20 for a stand alone php with some queries to my data but cannot find if there was a change in phpm24 to use executescalar.thank you in advance for any guidance
<?php
namespace PHPMaker2022\agro_met;
$sql="";
$geojsonstr="";
// Autoload
include_once "autoload.php";
$op=$_GET['op'];
if ($op=='lastold')
{
$sql="SELECT json_build_object('type', 'FeatureCollection', 'features', json_agg(st_asgeojson(t.*)::json)) AS response
FROM ( SELECT * from api_last) t;"; //outputs geojson
$geojsonstr =ExecuteScalar($sql);
} //last
// header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
header('Content-Type: application/json; charset=utf-8');
echo $geojsonstr;
?>
and it outputs json.Wanted to do the same in php2024 but gives this error:Fatal error: Uncaught Error: Call to undefined function PHPMaker2024\agro_met\ExecuteScalar() in C:\xampp_81\htdocs\agro-met_api.php:175 Stack trace: #0 {main} thrown in C:\xampp_81\htdocs\agro-met_api.php on line 175this is the phpm2024 code.
<?php
namespace PHPMaker2024\agro_met;
$sql="";
$geojsonstr="";
// Autoload
include_once "vendor/autoload.php";
$op=$_GET['op'];
if ($op=='lastold')
{
$sql="SELECT json_build_object('type', 'FeatureCollection', 'features', json_agg(st_asgeojson(t.*)::json)) AS response
FROM ( SELECT * from api_last) t;"; //outputs geojson
$geojsonstr =ExecuteScalar($sql);
} //last
// header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
header('Content-Type: application/json; charset=utf-8');
echo $geojsonstr;
?>