@@ -35,7 +35,7 @@ class db
3535 var $ dbUser = "" ; // database authorized user
3636 var $ dbPass = "" ; // user's password
3737 var $ dbCharset = "" ; // what charset comes and goes to mysql: utf8 / latin1
38- var $ linkId = 0 ; // last result of mysql_connect()
38+ var $ linkId = false ; // last result of mysql_connect()
3939 var $ queryId = 0 ; // last result of mysql_query()
4040 var $ record = array (); // last record fetched
4141 var $ autoCommit = 1 ; // Autocommit Transactions
@@ -61,8 +61,8 @@ function db()
6161 // error handler
6262 function updateError ($ location )
6363 {
64- $ this ->errorNumber = mysql_errno ( );
65- $ this ->errorMessage = mysql_error ( );
64+ $ this ->errorNumber = mysqli_errno ( $ this -> linkId );
65+ $ this ->errorMessage = mysqli_error ( $ this -> linkId );
6666 $ this ->errorLocation = $ location ;
6767 if ($ this ->errorNumber && $ this ->show_error_messages )
6868 {
@@ -73,16 +73,16 @@ function updateError($location)
7373
7474 function connect ()
7575 {
76- if ($ this ->linkId == 0 )
76+ if (! $ this ->linkId )
7777 {
78- $ this ->linkId = mysql_connect ($ this ->dbHost , $ this ->dbUser , $ this ->dbPass );
78+ $ this ->linkId = mysqli_connect ($ this ->dbHost , $ this ->dbUser , $ this ->dbPass );
7979
8080 if (!$ this ->linkId )
8181 {
82- $ this ->updateError ('DB::connect()<br />mysql_connect ' );
82+ $ this ->updateError ('DB::connect()<br />mysqli_connect ' );
8383 return false ;
8484 }
85- $ this ->queryId = @mysql_query ( 'SET NAMES ' .$ this ->dbCharset , $ this -> linkId );
85+ $ this ->queryId = @mysqli_query ( $ this -> linkId , 'SET NAMES ' .$ this ->dbCharset );
8686 }
8787 return true ;
8888 }
@@ -94,14 +94,14 @@ function query($queryString)
9494 return false ;
9595 }
9696 if ($ this ->dbName != '' ) {
97- if (!mysql_select_db ($ this ->dbName , $ this ->linkId ))
97+ if (!mysqli_select_db ($ this ->linkId , $ this ->dbName ))
9898 {
99- $ this ->updateError ('DB::connect()<br />mysql_select_db ' );
99+ $ this ->updateError ('DB::connect()<br />mysqli_select_db ' );
100100 return false ;
101101 }
102102 }
103- $ this ->queryId = @mysql_query ( $ queryString , $ this ->linkId );
104- $ this ->updateError ('DB::query( ' .$ queryString .')<br />mysql_query ' );
103+ $ this ->queryId = @mysqli_query ( $ this ->linkId , $ queryString );
104+ $ this ->updateError ('DB::query( ' .$ queryString .')<br />mysqli_query ' );
105105 if (!$ this ->queryId )
106106 {
107107 return false ;
@@ -138,8 +138,8 @@ function queryOneRecord($queryString)
138138 // returns the next record in an array
139139 function nextRecord ()
140140 {
141- $ this ->record = mysql_fetch_assoc ($ this ->queryId );
142- $ this ->updateError ('DB::nextRecord()<br />mysql_fetch_array ' );
141+ $ this ->record = mysqli_fetch_assoc ($ this ->queryId );
142+ $ this ->updateError ('DB::nextRecord()<br />mysqli_fetch_array ' );
143143 if (!$ this ->record || !is_array ($ this ->record ))
144144 {
145145 return false ;
@@ -151,18 +151,18 @@ function nextRecord()
151151 // returns number of rows returned by the last select query
152152 function numRows ()
153153 {
154- return mysql_num_rows ($ this ->queryId );
154+ return mysqli_num_rows ($ this ->queryId );
155155 }
156156
157157 function affectedRows ()
158158 {
159- return mysql_affected_rows ($ this ->linkId );
159+ return mysqli_affected_rows ($ this ->linkId );
160160 }
161161
162162 // returns mySQL insert id
163163 function insertID ()
164164 {
165- return mysql_insert_id ($ this ->linkId );
165+ return mysqli_insert_id ($ this ->linkId );
166166 }
167167
168168 // Check der variablen
@@ -175,7 +175,7 @@ function check($formfield)
175175 // Check der variablen
176176 function quote ($ formfield )
177177 {
178- return mysql_real_escape_string ( $ formfield );
178+ return mysqli_real_escape_string ( $ this -> linkId , $ formfield );
179179 }
180180
181181 // Check der variablen
@@ -359,11 +359,22 @@ function getTables($database_name = '') {
359359 if ($ database_name == '' ){
360360 $ database_name = $ this ->dbName ;
361361 }
362- $ result = mysql_query ("SHOW TABLES FROM ` $ database_name` " );
362+
363+ $ tables = $ this ->queryAllRecords ("SHOW TABLES FROM ` $ database_name` " );
364+ $ tb_names = array ();
365+ if (is_array ($ tables ) && !empty ($ tables )){
366+ for ($ i = 0 ; $ i < sizeof ($ tables ); $ i ++){
367+ $ tb_names [$ i ] = $ tables [$ i ]['Tables_in_ ' .$ database_name ];
368+ }
369+ }
370+
371+ /*
372+ $result = mysqli_query("SHOW TABLES FROM `$database_name`");
363373 $tb_names = array();
364- for ($ i = 0 ; $ i < mysql_num_rows ($ result ); $ i ++) {
374+ for ($i = 0; $i < mysqli_num_rows ($result); $i++) {
365375 $tb_names[$i] = mysql_tablename($result, $i);
366376 }
377+ */
367378 return $ tb_names ;
368379 }
369380
@@ -438,35 +449,7 @@ function tableInfo($table_name) {
438449 } else {
439450 return false ;
440451 }
441-
442-
443- //$this->createTable('tester',$columns);
444-
445- /*
446- $result = mysql_list_fields($go_info["server"]["db_name"],$table_name);
447- $fields = mysql_num_fields ($result);
448- $i = 0;
449- $table = mysql_field_table ($result, $i);
450- while ($i < $fields) {
451- $name = mysql_field_name ($result, $i);
452- $type = mysql_field_type ($result, $i);
453- $len = mysql_field_len ($result, $i);
454- $flags = mysql_field_flags ($result, $i);
455- print_r($flags);
456-
457- $columns = array(name => $name,
458- type => "",
459- defaultValue => "",
460- isnull => 1,
461- option => "");
462- $returnvar[] = $columns;
463-
464- $i++;
465- }
466- */
467-
468-
469-
452+
470453 }
471454
472455 function mapType ($ metaType ,$ typeValue ) {
0 commit comments