The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (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
#10
Instead of creating a near-duplicate method, I'd probably just modify the original slightly:

Code:
if ($this->_query->execute()) {
Code:
$type = substr($sql, 0, 6);
Code:
if ($type == 'SELECT') {
Code:
$this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
Code:
$this->_resultsArray = json_decode(json_encode($this->_results), true);
Code:
}
Code:
if ($type == 'INSERT') {
Code:
$this->_lastId = $this->_pdo->lastInsertId();
Code:
}
Code:
$this->_count = $this->_query->rowCount();
Code:
} else {
Code:
$this->_error = true;
Code:
}

This way you don't have to modify any code you've already written.

You probably won't have to worry about it being overwritten unless mudmin actually changes the class. Nearly all version updates deal with implementation and not the classes, and I'd suspect that if he does change the DB class it would be to make a similar change.
  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: 2 Guest(s)