function export_table2xls($table)
{
    $sql_query = "SELECT * FROM " . $table;
    $results = execute_query($sql_query);
    query2xls($results, 'xlsfiles/' . $table . '.xls');
    //	echo "<P>Table $table exported <A HREF='export/$table.xls'>here</A><P>";
    //	ob_implicit_flush();
}
Пример #2
0
    }
    $sql_query = stripslashes($_POST['query']);
    //	$highlightSQL =& Text_Highlighter::factory('SQL',array('numbers'=>true));
    //	echo "Executed QUERY : ";
    //	echo $highlightSQL->highlight($sql_query);
    highlight_string("Executed QUERY : " . $sql_query);
    echo "<BR><BR>";
    $results = execute_query($sql_query);
    //	print_r($results);
    //	echo "<BR><BR>";
    if ($results == "1") {
        echo "<table><tr><td>Query Successful!</td></tr></table>";
    } else {
        query2table($results);
        $result2 = execute_query($sql_query);
        query2xls($result2, 'query.xls');
        $result3 = execute_query($sql_query);
        query2csv($result3, 'query.csv');
        ?>
<P><A HREF="query.xls">Αποτελέσματα σε Excel</A></P>
<P><A HREF="query.csv">Αποτελέσματα σε CSV</A></P>
<?php 
    }
    mysql_close($dbconnection);
} else {
    ?>

<FORM METHOD=POST action="query.php">
<input type="text" id="query" style="font-family: courier new" size="120" name="query" value="SELECT * FROM "/>
<input type="submit" style="font-family: courier new"/>
<input type="button" style="font-family: courier new" value="Καθαρισμός" onclick="document.all.query.value='';"/>
Пример #3
0
    if ($clinic == "9") {
        if ($cohort_data_tables[$i] == 'patients') {
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET CodeType='NOKEELCODE', PatientCode = PatientCode - 99000 +  9*100000 WHERE PatientCode LIKE '99___'";
            execute_query($sql);
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET CodeType='NOKEELCODE', PatientCode = PatientCode - 9900 +  9*100000 WHERE PatientCode LIKE '99__'";
            execute_query($sql);
        } else {
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET PatientCode = PatientCode - 99000 +  9*100000 WHERE PatientCode LIKE '99___'";
            execute_query($sql);
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET PatientCode = PatientCode - 9900 +  9*100000 WHERE PatientCode LIKE '99__'";
            execute_query($sql);
        }
    } else {
        if ($cohort_data_tables[$i] == 'patients') {
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET CodeType='NOKEELCODE', PatientCode = PatientCode + " . $clinic . "*100000 WHERE PatientCode IN (SELECT PatientCode FROM patients_oldcodes WHERE PatientCode=MELCode)";
            execute_query($sql);
        } else {
            $sql = "UPDATE `" . $cohort_data_tables[$i] . "` SET PatientCode = PatientCode + " . $clinic . "*100000 WHERE PatientCode IN (SELECT PatientCode FROM patients_oldcodes WHERE PatientCode=MELCode)";
            execute_query($sql);
        }
    }
}
// 5. The rest are also KEEL codes
execute_query("UPDATE `patients` SET CodeType='FROMKEEL' WHERE CodeType=' ';");
$result = execute_query("SELECT b.PatientCode AS OLD_PatientCode, a.PatientCode AS NEW_PatientCode, a.MELCode, a.Name, a.Surname, a.BirthDate, a.CodeType FROM patients a, patients_oldcodes b WHERE a.AA=b.AA AND a.PatientCode!=b.PatientCode ;");
query2xls($result, "C:\\changed_patientcodes.xls");
execute_query("ALTER TABLE `patients` DROP `AA` ;");
execute_query("ALTER TABLE `patients` ADD PRIMARY KEY ( `PatientCode` ) ;");
// Other fixes (LAST MINUTE)
execute_query("UPDATE clinic_visits SET DrugUser=NULL");
mysql_close($dbconnection);