The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error reporting for DB queries
#9
So it appears that that the query in the DB class is not ideal for Insert or Update statements.

The following two lines in the query function are not available to insert or update statements as nothing is returned and as such the Fatal error above is being produced.


Quote:$this->_results = $this->_query->fetchALL(PDO::FETCH_OBJ);
$this->_resultsArray = json_decode(json_encode($this->_results),true);



All I did was create a query2 function and commented out the two lines. I then updated my Insert statement to use the query2 function instead of the query function.


Quote:public function query2($sql, $params = array()){
$this->_queryCount++;
$this->_error = false;
if ($this->_query = $this->_pdo->prepare($sql)) {
$x = 1;
if (count($params)) {
foreach ($params as $param) {
$this->_query->bindValue($x, $param);
$x++;
}
}

if ($this->_query->execute()) {
#$this->_results = $this->_query->fetchALL(PDO::FETCH_OBJ);
#$this->_resultsArray = json_decode(json_encode($this->_results),true);
$this->_count = $this->_query->rowCount();
$this->_lastId = $this->_pdo->lastInsertId();
} else{
$this->_error = true;
}
}
return $this;
}



mudmin I'd like to get your thoughts on the above? Is this change safe to make or do you see it breaking something else?

I am running 4.2.6 this may be sorted in a later release. I assume it will break once I upgrade if not.
  Reply


Messages In This Thread
Error reporting for DB queries - by plb - 08-27-2016, 12:47 PM
Error reporting for DB queries - by mudmin - 08-27-2016, 01:11 PM
Error reporting for DB queries - by mudmin - 08-27-2016, 01:11 PM
Error reporting for DB queries - by plb - 08-27-2016, 01:51 PM
Error reporting for DB queries - by waynez - 03-09-2017, 06:03 PM
Error reporting for DB queries - by mudmin - 03-09-2017, 09:32 PM
Error reporting for DB queries - by jmac - 08-15-2017, 10:57 AM
Error reporting for DB queries - by jmac - 08-15-2017, 11:58 AM
Error reporting for DB queries - by jmac - 08-15-2017, 11:25 PM
Error reporting for DB queries - by karsen - 08-17-2017, 06:26 PM
Error reporting for DB queries - by mudmin - 08-18-2017, 11:38 AM
Error reporting for DB queries - by mudmin - 08-18-2017, 03:01 PM
Error reporting for DB queries - by karsen - 08-18-2017, 05:09 PM
Error reporting for DB queries - by karsen - 08-18-2017, 07:06 PM
Error reporting for DB queries - by jmac - 08-19-2017, 04:34 AM
Error reporting for DB queries - by mudmin - 08-24-2017, 10:21 AM
Error reporting for DB queries - by mudmin - 08-25-2017, 12:14 PM
Error reporting for DB queries - by Katronix - 09-03-2017, 03:13 AM
Error reporting for DB queries - by Katronix - 09-03-2017, 03:32 AM
Error reporting for DB queries - by mudmin - 09-03-2017, 12:47 PM
Error reporting for DB queries - by Katronix - 09-03-2017, 02:56 PM
Error reporting for DB queries - by mudmin - 09-03-2017, 03:07 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)