我正在使用 postgres 扩展在 php 中准备一个语句。
然后我尝试使用pg_fetch_object.
从准备好的语句中没有返回任何行,但它应该。
我还收到以下警告:
警告:pg_prepare(): Query failed: ERROR: Prepared statement "parking" already exists in C:\xampp\htdocs\map\MapMarkers.php on line 33
$devices_query = pg_query($conn, "SELECT applications.name category, devices.* FROM app_as.application applications, app_as.device devices WHERE applications.id = devices.application_id");
//variables are bound in the loop
$parking_pst = pg_prepare($conn, "parking", "SELECT distinct on (name) name,application_name,longitude,latitude,parking_car_status status,received_at FROM V_DEVICE_PARKING WHERE name = $1");
while ($devices = pg_fetch_object($devices_query)) {
pg_execute($conn, "parking",[$devices->name]);
while ($parking = pg_fetch_object($parking_pst)) {
$devices->parking_car_status = $parking->parking_car_status;
}
$data['DEVICES'][] = $devices;
}
沧海一幻觉