@@ -49,7 +49,7 @@ class db
4949 private $ errorNumber = 0 ; // last error number
5050 public $ errorMessage = '' ; // last error message
5151 private $ errorLocation = '' ;// last error location
52- private $ show_error_messages = false ;
52+ public $ show_error_messages = false ;
5353
5454 public function __construct ()
5555 {
@@ -252,7 +252,7 @@ public function createTable($table_name, $columns)
252252 foreach ($ columns as $ col ){
253253 $ sql .= $ col ['name ' ].' ' .$ this ->mapType ($ col ['type ' ], $ col ['typeValue ' ]).' ' ;
254254 //* Set default value
255- if ($ col ['defaultValue ' ] != '' ) {
255+ if (isset ( $ col [ ' defaultValue ' ]) && $ col ['defaultValue ' ] != '' ) {
256256 if ($ col ['defaultValue ' ] == 'NULL ' or $ col ['defaultValue ' ] == 'NOT NULL ' ) {
257257 $ sql .= 'DEFAULT ' .$ col ['defaultValue ' ].' ' ;
258258 } else {
@@ -261,19 +261,19 @@ public function createTable($table_name, $columns)
261261 } elseif ($ col ['defaultValue ' ] != false ) {
262262 $ sql .= "DEFAULT '' " ;
263263 }
264- if ($ col ['defaultValue ' ] != 'NULL ' && $ col ['defaultValue ' ] != 'NOT NULL ' ) {
264+ if (isset ( $ col [ ' defaultValue ' ]) && $ col ['defaultValue ' ] != 'NULL ' && $ col ['defaultValue ' ] != 'NOT NULL ' ) {
265265 if ($ col ['notNull ' ] == true ) {
266266 $ sql .= 'NOT NULL ' ;
267267 } else {
268268 $ sql .= 'NULL ' ;
269269 }
270270 }
271- if ($ col ['autoInc ' ] == true ){ $ sql .= 'auto_increment ' ; }
271+ if (isset ( $ col [ ' autoInc ' ]) && $ col ['autoInc ' ] == true ){ $ sql .= 'auto_increment ' ; }
272272 $ sql .= ', ' ;
273273 //* Index Definitions
274- if ($ col ['option ' ] == 'primary ' ){ $ index .= 'PRIMARY KEY ( ' .$ col ['name ' ].'), ' ; }
275- if ($ col ['option ' ] == 'index ' ){ $ index .= 'INDEX ( ' .$ col ['name ' ].'), ' ; }
276- if ($ col ['option ' ] == 'unique ' ){ $ index .= 'UNIQUE ( ' .$ col ['name ' ].'), ' ; }
274+ if (isset ( $ col [ ' option ' ]) && $ col ['option ' ] == 'primary ' ){ $ index .= 'PRIMARY KEY ( ' .$ col ['name ' ].'), ' ; }
275+ if (isset ( $ col [ ' option ' ]) && $ col ['option ' ] == 'index ' ){ $ index .= 'INDEX ( ' .$ col ['name ' ].'), ' ; }
276+ if (isset ( $ col [ ' option ' ]) && $ col ['option ' ] == 'unique ' ){ $ index .= 'UNIQUE ( ' .$ col ['name ' ].'), ' ; }
277277 }
278278 $ sql .= $ index ;
279279 $ sql = substr ($ sql ,0 ,-1 );
0 commit comments