<?php require_once './include/basic_defines.inc.php'; require_once './include/basic_functions.inc.php'; PrintHeaders(); $dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password); $db_selected = mysql_select_db($cohort_db_name, $dbconnection); if (!$db_selected) { die('Can\'t use " . $cohort_db_name . " : ' . mysql_error()); } $result = execute_query("SELECT * FROM demographic_data"); query2table($result); //query2xls($result, 'query.xls'); //query2csv($result, 'query.csv'); //send_file('query.csv'); mysql_close($dbconnection); //createMenu(); CloseHTML();
if (!$db_selected) { die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error()); } $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 "/>
<?php //require_once 'Text/Highlighter.php'; $dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password); $db_selected = mysql_select_db($cohort_db_name, $dbconnection); if (!$db_selected) { die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error()); } if (isset($_POST['query'])) { $sql_query = "INSERT INTO iris_antimetopisi VALUES('', '" . $_POST['query'] . "')"; $results = execute_query($sql_query); } $table_query = "SELECT * FROM iris_antimetopisi"; $table_results = execute_query($table_query); // print_r($results); // echo "<BR><BR>"; query2table($table_results); echo mysql_error(); mysql_close($dbconnection); ?> <p>Προσθήκη στοιχείου<p> <FORM METHOD=POST action="iris_ant_insert.php"> <input type="text" id="query" style="font-family: courier new" name="query"/> <p> <input type="submit" value="Προσθήκη" style="font-family: courier new"/> <input type="button" style="font-family: courier new" value="Καθαρισμός" onclick="document.all.query.value='';"/></p> </form> </BODY></HTML>
<META http-equiv=Content-Type content="text/html; charset=windows-1253"> <link href="./include/cohort.css" rel="stylesheet" type="text/css"> </HEAD> <?php PrintTopMenu(); ?> <p> </p> <p> </p> <?php $workbook =& new Spreadsheet_Excel_Writer(); $workbook->send("db_dump.xls"); $template_query = "DESCRIBE "; $tables_result = execute_query("SHOW TABLES"); $num = mysql_num_rows($tables_result); for ($i = 0; $i < $num; $i++) { $table = mysql_fetch_array($tables_result); $temp_result = execute_query($template_query . $table[0]); echo "<p>Table: " . $table[0] . "</p>"; query2table($temp_result); mysql_free_result($temp_result); // $temp_result = execute_query($template_query . $table[0]); // add_sheet($temp_result, $table[0], $workbook); // mysql_free_result($temp_result); } $workbook->close(); ?> </BODY></HTML>