Command: Database class integration.
This commit is contained in:
parent
6fe372b3d4
commit
ebfec8c31f
|
|
@ -259,13 +259,15 @@
|
||||||
case 'pgsql': $sql = "select table_name as name from information_schema.tables where table_schema='public' and table_type='BASE TABLE' order by table_name"; break;
|
case 'pgsql': $sql = "select table_name as name from information_schema.tables where table_schema='public' and table_type='BASE TABLE' order by table_name"; break;
|
||||||
case 'mysql': $sql = "show tables"; break;
|
case 'mysql': $sql = "show tables"; break;
|
||||||
}
|
}
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
$prep_statement->execute();
|
$result = $database->select($sql, null, 'all');
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
if (is_array($result) && @sizeof($result) != 0) {
|
||||||
foreach ($result as &$row) {
|
foreach ($result as &$row) {
|
||||||
$row = array_values($row);
|
$row = array_values($row);
|
||||||
echo " <option value='".escape($row[0])."'>".escape($row[0])."</option>\n";
|
echo " <option value='".escape($row[0])."'>".escape($row[0])."</option>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
unset($sql, $result, $row);
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
//echo " <br /><br />\n";
|
//echo " <br /><br />\n";
|
||||||
//echo " ".$text['label-result_type']."<br />";
|
//echo " ".$text['label-result_type']."<br />";
|
||||||
|
|
@ -366,21 +368,21 @@
|
||||||
<td valign='middle' style='padding-left: 4px; padding-right: 0px;'>
|
<td valign='middle' style='padding-left: 4px; padding-right: 0px;'>
|
||||||
<select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
|
<select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
|
||||||
<?php
|
<?php
|
||||||
$themes['Bright']['chrome']= 'Chrome';
|
$themes['Light']['chrome']= 'Chrome';
|
||||||
$themes['Bright']['clouds']= 'Clouds';
|
$themes['Light']['clouds']= 'Clouds';
|
||||||
$themes['Bright']['crimson_editor']= 'Crimson Editor';
|
$themes['Light']['crimson_editor']= 'Crimson Editor';
|
||||||
$themes['Bright']['dawn']= 'Dawn';
|
$themes['Light']['dawn']= 'Dawn';
|
||||||
$themes['Bright']['dreamweaver']= 'Dreamweaver';
|
$themes['Light']['dreamweaver']= 'Dreamweaver';
|
||||||
$themes['Bright']['eclipse']= 'Eclipse';
|
$themes['Light']['eclipse']= 'Eclipse';
|
||||||
$themes['Bright']['github']= 'GitHub';
|
$themes['Light']['github']= 'GitHub';
|
||||||
$themes['Bright']['iplastic']= 'IPlastic';
|
$themes['Light']['iplastic']= 'IPlastic';
|
||||||
$themes['Bright']['solarized_light']= 'Solarized Light';
|
$themes['Light']['solarized_light']= 'Solarized Light';
|
||||||
$themes['Bright']['textmate']= 'TextMate';
|
$themes['Light']['textmate']= 'TextMate';
|
||||||
$themes['Bright']['tomorrow']= 'Tomorrow';
|
$themes['Light']['tomorrow']= 'Tomorrow';
|
||||||
$themes['Bright']['xcode']= 'XCode';
|
$themes['Light']['xcode']= 'XCode';
|
||||||
$themes['Bright']['kuroir']= 'Kuroir';
|
$themes['Light']['kuroir']= 'Kuroir';
|
||||||
$themes['Bright']['katzenmilch']= 'KatzenMilch';
|
$themes['Light']['katzenmilch']= 'KatzenMilch';
|
||||||
$themes['Bright']['sqlserver']= 'SQL Server';
|
$themes['Light']['sqlserver']= 'SQL Server';
|
||||||
$themes['Dark']['ambiance']= 'Ambiance';
|
$themes['Dark']['ambiance']= 'Ambiance';
|
||||||
$themes['Dark']['chaos']= 'Chaos';
|
$themes['Dark']['chaos']= 'Chaos';
|
||||||
$themes['Dark']['clouds_midnight']= 'Clouds Midnight';
|
$themes['Dark']['clouds_midnight']= 'Clouds Midnight';
|
||||||
|
|
@ -416,7 +418,7 @@
|
||||||
</table>
|
</table>
|
||||||
<div id='editor'><?php echo escape($command); ?></div>
|
<div id='editor'><?php echo escape($command); ?></div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo " </td>";
|
echo " </td>";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@
|
||||||
|
|
||||||
//get the list of tables
|
//get the list of tables
|
||||||
if ($db_type == "sqlite") {
|
if ($db_type == "sqlite") {
|
||||||
$sql = "SELECT name FROM sqlite_master ";
|
$sql = "select name from sqlite_master ";
|
||||||
$sql .= "WHERE type='table' ";
|
$sql .= "where type='table' ";
|
||||||
$sql .= "order by name;";
|
$sql .= "order by name;";
|
||||||
}
|
}
|
||||||
if ($db_type == "pgsql") {
|
if ($db_type == "pgsql") {
|
||||||
|
|
@ -104,78 +104,50 @@
|
||||||
if ($db_type == "mysql") {
|
if ($db_type == "mysql") {
|
||||||
$sql = "show tables";
|
$sql = "show tables";
|
||||||
}
|
}
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
$prep_statement->execute();
|
$result_1 = $database->select($sql, null, 'all');
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
unset($sql);
|
||||||
foreach ($result as &$row) {
|
|
||||||
$row = array_values($row);
|
|
||||||
$table_name = $row[0];
|
|
||||||
|
|
||||||
//get the table data
|
if (is_array($result_1) && @sizeof($result_1) != 0) {
|
||||||
$sql = "select * from $table_name";
|
foreach ($result_1 as &$row_1) {
|
||||||
if (strlen($sql) > 0) {
|
$row_1 = array_values($row_1);
|
||||||
$prep_statement_2 = $db->prepare(check_sql($sql));
|
$table_name = $row_1[0];
|
||||||
if ($prep_statement_2) {
|
|
||||||
$prep_statement_2->execute();
|
|
||||||
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "<b>".$text['label-error'].":</b>\n";
|
|
||||||
echo "<pre>\n";
|
|
||||||
print_r($db->errorInfo());
|
|
||||||
echo "</pre>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$x = 0;
|
//get the table data
|
||||||
foreach ($result2[0] as $key => $value) {
|
$sql = "select * from ".$table_name;
|
||||||
if ($row[$column] != "db") {
|
$database = new database;
|
||||||
|
$result_2 = $database->select($sql, null, 'all');
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
foreach ($result_2[0] as $key => $value) {
|
||||||
|
if ($row_1[$column] != "db") {
|
||||||
if (field_exists($apps, $table_name, $key)) {
|
if (field_exists($apps, $table_name, $key)) {
|
||||||
$column_array[$x] = $key;
|
$column_array[] = $key;
|
||||||
}
|
}
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$column_array_count = count($column_array);
|
$column_array_count = count($column_array);
|
||||||
|
|
||||||
foreach ($result2 as &$row) {
|
foreach ($result_2 as &$row_2) {
|
||||||
$sql = "INSERT INTO $table_name (";
|
|
||||||
$x = 1;
|
|
||||||
foreach ($column_array as $column) {
|
foreach ($column_array as $column) {
|
||||||
if ($x < $column_array_count) {
|
$columns[] = $column;
|
||||||
if (strlen($row[$column]) > 0) {
|
$values[] = $row_2[$column] != '' ? "'".check_str($row_2[$column])."'" : 'null';
|
||||||
$sql .= ''.$column.',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (strlen($row[$column]) > 0) {
|
|
||||||
$sql .= ''.$column.'';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
$sql .= ") ";
|
$sql = "insert into ".$table_name." (";
|
||||||
$sql .= "VALUES( ";
|
$sql .= implode(', ', $columns);
|
||||||
$x = 1;
|
$sql .= ") values ( ";
|
||||||
foreach ($column_array as $column) {
|
$sql .= implode(', ', $values);
|
||||||
if ($x < $column_array_count) {
|
$sql .= ");";
|
||||||
if (strlen($row[$column])> 0) {
|
echo $sql."\n";
|
||||||
$sql .= "'".check_str($row[$column])."',";
|
|
||||||
}
|
unset($columns, $values);
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (strlen($row[$column])> 0) {
|
|
||||||
$sql .= "'".check_str($row[$column])."'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
$sql .= ");\n";
|
|
||||||
echo str_replace(",)", ")", $sql);
|
|
||||||
}
|
}
|
||||||
}
|
unset($result_2, $row_2);
|
||||||
|
|
||||||
unset($column_array);
|
unset($column_array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
unset($result_1, $row_1);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -73,14 +73,9 @@
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
$sql = "select count(*) as num_rows from v_databases ";
|
$sql = "select count(*) from v_databases ";
|
||||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
$database = new database;
|
||||||
$prep_statement = $db->prepare($sql);
|
$num_rows = $database->select($sql, null, 'column');
|
||||||
if ($prep_statement) {
|
|
||||||
$prep_statement->execute();
|
|
||||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
|
||||||
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||||
|
|
@ -91,14 +86,12 @@
|
||||||
$offset = $rows_per_page * $page;
|
$offset = $rows_per_page * $page;
|
||||||
|
|
||||||
//get the list
|
//get the list
|
||||||
$sql = "select * from v_databases ";
|
$sql = str_replace('count(*)', '*', $sql);
|
||||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
$sql .= order_by($order_by, $order);
|
||||||
$sql .= "limit $rows_per_page offset $offset ";
|
$sql .= limit_offset($rows_per_page, $offset);
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
$prep_statement->execute();
|
$result = $database->select($sql, null, 'all');
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
unset($sql);
|
||||||
$result_count = count($result);
|
|
||||||
unset ($prep_statement, $sql);
|
|
||||||
|
|
||||||
$c = 0;
|
$c = 0;
|
||||||
$row_style["0"] = "row_style0";
|
$row_style["0"] = "row_style0";
|
||||||
|
|
@ -113,7 +106,7 @@
|
||||||
echo "<td class='list_control_icons' style='width: 25px;'> </td>\n";
|
echo "<td class='list_control_icons' style='width: 25px;'> </td>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
|
||||||
if (is_array($result)) {
|
if (is_array($result) && @sizeof($result) != 0) {
|
||||||
foreach($result as $row) {
|
foreach($result as $row) {
|
||||||
$tr_link = "href='exec.php?id=".escape($row['database_uuid'])."'";
|
$tr_link = "href='exec.php?id=".escape($row['database_uuid'])."'";
|
||||||
echo "<tr ".$tr_link.">\n";
|
echo "<tr ".$tr_link.">\n";
|
||||||
|
|
@ -126,9 +119,9 @@
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
$c = ($c == 0) ? 1 : 0;
|
$c = ($c == 0) ? 1 : 0;
|
||||||
} //end foreach
|
}
|
||||||
unset($sql, $result, $row_count);
|
}
|
||||||
} //end if results
|
unset($result, $row);
|
||||||
|
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the db connection information
|
//get the db connection information
|
||||||
if (strlen($_REQUEST['id']) > 0) {
|
if (is_uuid($_REQUEST['id'])) {
|
||||||
$sql = "select * from v_databases ";
|
$sql = "select * from v_databases ";
|
||||||
$sql .= "where database_uuid = '".$_REQUEST['id']."' ";
|
$sql .= "where database_uuid = :database_uuid ";
|
||||||
$prep_statement = $db->prepare($sql);
|
$parameters['database_uuid'] = $_REQUEST['id'];
|
||||||
$prep_statement->execute();
|
$database = new database;
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
$row = $database->select($sql, $parameters, 'row');
|
||||||
foreach ($result as &$row) {
|
if (is_array($row) && @sizeof($row) != 0) {
|
||||||
$db_type = $row["database_type"];
|
$db_type = $row["database_type"];
|
||||||
$db_host = $row["database_host"];
|
$db_host = $row["database_host"];
|
||||||
$db_port = $row["database_port"];
|
$db_port = $row["database_port"];
|
||||||
|
|
@ -59,8 +59,8 @@
|
||||||
$db_username = $row["database_username"];
|
$db_username = $row["database_username"];
|
||||||
$db_password = $row["database_password"];
|
$db_password = $row["database_password"];
|
||||||
$db_path = $row["database_path"];
|
$db_path = $row["database_path"];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
unset($sql, $parameters, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
//unset the database connection
|
//unset the database connection
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@
|
||||||
$header .= " text-align: left;\n";
|
$header .= " text-align: left;\n";
|
||||||
$header .= " vertical-align: top;\n";
|
$header .= " vertical-align: top;\n";
|
||||||
$header .= "}\n";
|
$header .= "}\n";
|
||||||
$header .= "\n";
|
|
||||||
$header .= "</style>";
|
$header .= "</style>";
|
||||||
$header .= "</head>\n";
|
$header .= "</head>\n";
|
||||||
$header .= "<body style='margin: 0; padding: 8;'>\n";
|
$header .= "<body style='margin: 0; padding: 8;'>\n";
|
||||||
|
|
@ -141,46 +140,56 @@
|
||||||
|
|
||||||
if (sizeof($sql_array) > 1 || $show_query) {
|
if (sizeof($sql_array) > 1 || $show_query) {
|
||||||
if ($sql_index > 0) { echo "<br /><br /><br />"; }
|
if ($sql_index > 0) { echo "<br /><br /><br />"; }
|
||||||
echo "<span style='display: block; padding: 8px; color: green; background-color: #eefff0;'>".escape($sql).";</span><br />";
|
echo "<span style='display: block; font-family: monospace; padding: 8px; color: green; background-color: #eefff0;'>".escape($sql).";</span><br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$database = new database;
|
||||||
try {
|
$result = $database->execute($sql, null, 'all');
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$message = $database->message;
|
||||||
$prep_statement->execute();
|
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
if ($message['message'] == 'OK' && $message['code'] == 200) {
|
||||||
echo "<b>".$text['label-records'].": ".count($result)."</b>";
|
echo "<b>".$text['label-records'].": ".count($result)."</b>";
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
}
|
}
|
||||||
catch(PDOException $e) {
|
else {
|
||||||
echo "<b>".$text['label-error']."</b>";
|
echo "<b>".$text['label-error']."</b>";
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
echo $e->getMessage();
|
echo $message['message'].' ['.$message['code']."]<br />\n";
|
||||||
echo "<br /><br />\n";
|
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
|
||||||
|
foreach ($message['error'] as $error) {
|
||||||
|
echo "<pre>".$error."</pre><br /><br />\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
$x = 0;
|
$x = 0;
|
||||||
if (is_array($result[0])) {
|
if (is_array($result[0])) {
|
||||||
|
echo "<thead>\n";
|
||||||
|
echo " <tr>\n";
|
||||||
foreach ($result[0] as $key => $value) {
|
foreach ($result[0] as $key => $value) {
|
||||||
echo "<th>".escape($key)."</th>";
|
echo "<th>".escape($key)."</th>\n";
|
||||||
$column_array[$x++] = $key;
|
$column_array[$x++] = $key;
|
||||||
}
|
}
|
||||||
|
echo " </tr>\n";
|
||||||
|
echo "</thead>\n";
|
||||||
}
|
}
|
||||||
$x = 1;
|
$x = 1;
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
|
echo "<tbody>\n";
|
||||||
foreach ($result as &$row) {
|
foreach ($result as &$row) {
|
||||||
if ($x++ > 1000) { break; }
|
if ($x++ > 1000) { break; }
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
if (is_array($column_array)) {
|
if (is_array($column_array)) {
|
||||||
foreach ($column_array as $column_index => $column) {
|
foreach ($column_array as $column_index => $column) {
|
||||||
echo "<td class='".$row_style[$c]."' ".(($column_index == 0) ? "style='border-left: none;'" : null).">".escape($row[$column])." </td>";
|
echo "<td class='".$row_style[$c]."' ".(($column_index == 0) ? "style='border-left: none;'" : null).">".escape($row[$column])." </td>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
$c = ($c == 0) ? 1 : 0;
|
$c = ($c == 0) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
echo "</tbody>\n";
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo "<br>\n";
|
echo "<br>\n";
|
||||||
|
|
@ -199,19 +208,22 @@
|
||||||
$sql = (strlen($sql_cmd) == 0) ? "select * from ".$table_name : $sql_cmd;
|
$sql = (strlen($sql_cmd) == 0) ? "select * from ".$table_name : $sql_cmd;
|
||||||
|
|
||||||
if (strlen($sql) > 0) {
|
if (strlen($sql) > 0) {
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
if ($prep_statement) {
|
$result = $database->execute($sql);
|
||||||
$prep_statement->execute();
|
$message = $database->message;
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
if ($message['message'] != 'OK' || $message['code'] != 200) {
|
||||||
else {
|
echo "<b>".$text['label-error']."</b>";
|
||||||
echo "<b>".$text['label-error']."</b>\n";
|
|
||||||
echo "<br /><br />\n";
|
|
||||||
echo "<pre>".print_r($db->errorInfo(), true)."</pre>\n";
|
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
|
echo $message['message'].' ['.$message['code']."]<br />\n";
|
||||||
|
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
|
||||||
|
foreach ($message['error'] as $error) {
|
||||||
|
echo "<pre>".$error."</pre><br /><br />\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = 0;
|
$x = 0;
|
||||||
if (is_array($result[0])) {
|
if (is_array($result[0])) {
|
||||||
foreach ($result[0] as $key => $value) {
|
foreach ($result[0] as $key => $value) {
|
||||||
|
|
@ -220,36 +232,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$column_array_count = count($column_array);
|
$column_array_count = count($column_array);
|
||||||
if (is_array($result)) foreach ($result as &$row) {
|
if (is_array($result)) foreach ($result as $index => &$row) {
|
||||||
|
|
||||||
|
echo "<div style='font-family: monospace; border-bottom: 1px solid #ccc; padding-bottom: 8px; ".($index != 0 ? 'padding-top: 8px;' : null)."'>\n";
|
||||||
echo "insert into ".$table_name." (";
|
echo "insert into ".$table_name." (";
|
||||||
$x = 1;
|
|
||||||
if (is_array($column_array)) {
|
if (is_array($column_array)) {
|
||||||
foreach ($column_array as $column) {
|
foreach ($column_array as $column) {
|
||||||
if ($column != "menuid" && $column != "menuparentid") {
|
if ($column != "menuid" && $column != "menuparentid") {
|
||||||
$columns[] = $column;
|
$columns[] = $column;
|
||||||
}
|
}
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($columns) && sizeof($columns) > 0) {
|
if (is_array($columns) && sizeof($columns) > 0) {
|
||||||
echo implode(', ', $columns);
|
echo implode(', ', $columns);
|
||||||
}
|
}
|
||||||
echo ") values (";
|
echo ") values (";
|
||||||
$x = 1;
|
|
||||||
if (is_array($column_array)) {
|
if (is_array($column_array)) {
|
||||||
foreach ($column_array as $column) {
|
foreach ($column_array as $column) {
|
||||||
if ($column != "menuid" && $column != "menuparentid") {
|
if ($column != "menuid" && $column != "menuparentid") {
|
||||||
$values[] = ($row[$column] != '') ? "'".check_str($row[$column])."'" : 'null';
|
$values[] = $row[$column] != '' ? "'".escape($row[$column])."'" : 'null';
|
||||||
}
|
}
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($values) && sizeof($values) > 0) {
|
if (is_array($values) && sizeof($values) > 0) {
|
||||||
echo implode(', ', escape($values));
|
echo implode(', ', $values);
|
||||||
}
|
}
|
||||||
echo ");<br />\n";
|
echo ");\n";
|
||||||
|
echo "</div>\n";
|
||||||
unset($columns, $values);
|
unset($columns, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
echo $footer;
|
echo $footer;
|
||||||
}
|
}
|
||||||
|
|
@ -273,16 +285,19 @@
|
||||||
$sql = "select * from ".$table_name;
|
$sql = "select * from ".$table_name;
|
||||||
}
|
}
|
||||||
if (strlen($sql) > 0) {
|
if (strlen($sql) > 0) {
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
if ($prep_statement) {
|
$result = $database->execute($sql);
|
||||||
$prep_statement->execute();
|
$message = $database->message;
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
if ($message['message'] != 'OK' || $message['code'] != 200) {
|
||||||
else {
|
echo "<b>".$text['label-error']."</b>";
|
||||||
echo "<b>".$text['label-error']."</b>\n";
|
|
||||||
echo "<br /><br />\n";
|
|
||||||
echo "<pre>".print_r($db->errorInfo(), true)."</pre>\n";
|
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
|
echo $message['message'].' ['.$message['code']."]<br />\n";
|
||||||
|
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
|
||||||
|
foreach ($message['error'] as $error) {
|
||||||
|
echo "<pre>".$error."</pre><br /><br />\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue