PHP function db::num_rows() accepts a result index as argument
(default = 0 -> use result from the previous query).
New PHP function db::fetch_object().
$this->db_result = pg_exec ($this->db_connection, $inp_sql_query);
$this->db_row_number = 0;
$this->db_result = pg_exec ($this->db_connection, $inp_sql_query);
$this->db_row_number = 0;
+ return $this->db_result;
+ function fetch_object($result, $row)
+ {
+ return pg_fetch_object($result, $row);
+ }
+
+ function num_rows($db_result = 0) {
/* This functions returns the number of rows in a resultset
/* This functions returns the number of rows in a resultset
+ * INPUT : Postgres result index (default = internal result)..
* OUTPUT : Number of rows (number)
*/
* OUTPUT : Number of rows (number)
*/
- return pg_numrows($this->db_result);
+
+ if ($db_result == 0)
+ {
+ // Default: use result from inside the object.
+
+ $db_result = $this->db_result;
+ }
+ return pg_numrows($db_result);
+
// 4.2.X return pg_num_rows($this->db_result);
}
// 4.2.X return pg_num_rows($this->db_result);
}