@@ -41,7 +41,7 @@ class db
4141 var $ errorNumber = 0 ; // last error number
4242 var $ errorMessage = "" ; // last error message
4343 var $ errorLocation = "" ;// last error location
44- var $ show_error_messages = false ;
44+ var $ show_error_messages = true ;
4545
4646 // constructor
4747 function db ()
@@ -58,13 +58,15 @@ function db()
5858 // error handler
5959 function updateError ($ location )
6060 {
61+ global $ app ;
6162 $ this ->errorNumber = mysql_errno ();
6263 $ this ->errorMessage = mysql_error ();
6364 $ this ->errorLocation = $ location ;
64- if ($ this ->errorNumber && $ this ->show_error_messages )
65+ if ($ this ->errorNumber && $ this ->show_error_messages && method_exists ( $ app , ' log ' ) )
6566 {
66- echo ('<br /><b> ' .$ this ->errorLocation .'</b><br /> ' .$ this ->errorMessage );
67- flush ();
67+ // echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
68+ $ app ->log ($ this ->errorLocation ." " .$ this ->errorMessage ,LOGLEVEL_WARN );
69+ //flush();
6870 }
6971 }
7072
@@ -75,7 +77,7 @@ function connect()
7577 $ this ->linkId = mysql_connect ($ this ->dbHost , $ this ->dbUser , $ this ->dbPass );
7678 if (!$ this ->linkId )
7779 {
78- $ this ->updateError ('DB::connect()<br /> mysql_connect ' );
80+ $ this ->updateError ('DB::connect()-> mysql_connect ' );
7981 return false ;
8082 }
8183 }
@@ -90,11 +92,11 @@ function query($queryString)
9092 }
9193 if (!mysql_select_db ($ this ->dbName , $ this ->linkId ))
9294 {
93- $ this ->updateError ('DB::connect()<br /> mysql_select_db ' );
95+ $ this ->updateError ('DB::connect()-> mysql_select_db ' );
9496 return false ;
9597 }
9698 $ this ->queryId = @mysql_query ($ queryString , $ this ->linkId );
97- $ this ->updateError ('DB::query( ' .$ queryString .')<br /> mysql_query ' );
99+ $ this ->updateError ('DB::query( ' .$ queryString .') -> mysql_query ' );
98100 if (!$ this ->queryId )
99101 {
100102 return false ;
@@ -132,7 +134,7 @@ function queryOneRecord($queryString)
132134 function nextRecord ()
133135 {
134136 $ this ->record = mysql_fetch_assoc ($ this ->queryId );
135- $ this ->updateError ('DB::nextRecord()<br /> mysql_fetch_array ' );
137+ $ this ->updateError ('DB::nextRecord()-> mysql_fetch_array ' );
136138 if (!$ this ->record || !is_array ($ this ->record ))
137139 {
138140 return false ;
0 commit comments