// create LM object, pass in PDO connection $lm = new lazy_mofo($dbh); // table name for updates, inserts and deletes $lm->table = $tablename; // identity / primary key for table if (strtolower(substr($lm->table, 0, 5)) == "code_") { $lm->identity_name = 'id'; } else { if (strtolower(substr($lm->table, 0, 3)) == "lo_") { $lm->identity_name = 'id'; } else { $lm->identity_name = 'id'; } } $sSQL = "SHOW COLUMNS FROM {$tablename}"; $result = $lm->query($sSQL); //$result=mysql_query($sSQL) or die("error:".mysql_error()); foreach ($result as $row) { $column_name = $row['Field']; if ($row['Null'] == "NO") { $lm->required[$column_name] = "*"; } if ($row['Type'] == "datetime") { $lm->form_input_control[$column_name] = "--datetime"; $lm->grid_input_control[$column_name] = "--datetime"; } else { if ($row['Type'] == "date") { $lm->form_input_control[$column_name] = "--date"; $lm->grid_input_control[$column_name] = "--date"; } else { if ($row['Type'] == "bit" || $row['Type'] == "tinyint(1)" || strtoupper($column_name) == "ACTIVE") {
// identity / primary key for table if (strtolower(substr($lm->table, 0, 5)) == "code_") { $lm->identity_name = 'id'; } else { if (strtolower(substr($lm->table, 0, 3)) == "lo_") { $lm->identity_name = 'id'; } else { $lm->identity_name = 'id'; } } $rel_parents = array(); $rel_columns = array(); $rel_tables = array(); $lm->grid_show_search_box = true; $sSQL = "SHOW COLUMNS FROM {$tablename}"; $result = $lm->query($sSQL); //$result=mysql_query($sSQL) or die("error:".mysql_error()); foreach ($result as $row) { $column_name = $row['Field']; if ($row['Null'] == "NO") { $lm->required[$column_name] = "*"; } if ($row['Type'] == "datetime") { $lm->form_input_control[$column_name] = "--datetime"; $lm->grid_input_control[$column_name] = "--datetime"; } else { if ($row['Type'] == "date") { $lm->form_input_control[$column_name] = "--date"; $lm->grid_input_control[$column_name] = "--date"; } else { if ($row['Type'] == "bit" || $row['Type'] == "tinyint(1)" || strtoupper($column_name) == "ACTIVE") {