@@ -470,6 +470,9 @@ private function run()
470
470
*/
471
471
public function row ($ fetch = 'object ' )
472
472
{
473
+ // Reset
474
+ $ this ->reset ();
475
+
473
476
// Run Query
474
477
$ query = $ this ->pdo ->query ($ this ->sql );
475
478
@@ -480,9 +483,6 @@ public function row($fetch = 'object')
480
483
else
481
484
$ row = $ query ->fetch (\PDO ::FETCH_OBJ );
482
485
483
- // Reset
484
- $ this ->reset ();
485
-
486
486
return $ row ;
487
487
}
488
488
catch (\PDOException $ e )
@@ -498,6 +498,9 @@ public function row($fetch = 'object')
498
498
*/
499
499
public function results ($ fetch = 'object ' )
500
500
{
501
+ // Reset
502
+ $ this ->reset ();
503
+
501
504
// Run Query
502
505
$ query = $ this ->pdo ->query ($ this ->sql );
503
506
@@ -512,9 +515,6 @@ public function results($fetch = 'object')
512
515
// Row Count
513
516
$ this ->num_rows = $ query ->rowCount ();
514
517
515
- // Reset
516
- $ this ->reset ();
517
-
518
518
return $ result ;
519
519
}
520
520
catch (\PDOException $ e )
@@ -588,6 +588,9 @@ public function insert($table, $data = [])
588
588
589
589
try
590
590
{
591
+ // Reset
592
+ $ this ->reset ();
593
+
591
594
$ query = $ this ->pdo ->prepare ($ this ->sql );
592
595
$ insert = $ query ->execute ($ val );
593
596
$ this ->insert_id = $ this ->pdo ->lastInsertId ();
@@ -641,11 +644,11 @@ public function update($table, $data = [])
641
644
642
645
try
643
646
{
644
- $ query = $ this ->pdo ->prepare ($ this ->sql );
645
- $ update = $ query ->execute ($ val );
646
-
647
647
// Reset
648
648
$ this ->reset ();
649
+
650
+ $ query = $ this ->pdo ->prepare ($ this ->sql );
651
+ $ update = $ query ->execute ($ val );
649
652
650
653
return $ update ;
651
654
}
@@ -684,12 +687,12 @@ public function delete($table)
684
687
685
688
try
686
689
{
687
- $ query = $ this ->pdo ->prepare ($ this ->sql );
688
- $ delete = $ query ->execute ($ val );
689
-
690
690
// Reset
691
691
$ this ->reset ();
692
692
693
+ $ query = $ this ->pdo ->prepare ($ this ->sql );
694
+ $ delete = $ query ->execute ($ val );
695
+
693
696
return $ delete ;
694
697
}
695
698
catch (\PDOException $ e )
@@ -749,7 +752,6 @@ private function reset()
749
752
$ this ->join = [];
750
753
$ this ->order_by = [];
751
754
$ this ->having = [];
752
- $ this ->insert_id = null ;
753
755
$ this ->error = null ;
754
756
$ this ->from = null ;
755
757
$ this ->group_by = null ;
0 commit comments