To integrate it to the left nav bar you can add the following code to index.php:
Code:
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Database Management"); ?>
</table>
<a href="query.php?action=new"> Query </a> |
<a href="mysqlstatus.php"> MySQL Stats </a>
</td></tr>
I put it between
Custom BB codes and
Backup database
That the query page is then in your cpl look (css works) create
query.php with the following code:
Code:
<?php
require ("global.php");
if ($action=="new") {
cpheader();
?>
<FORM ACTION="query.php?action=run" METHOD=POST>
Please input the SQL query to be executed:<BR><BR>
<TEXTAREA NAME="query" COLS=50 ROWS=10></TEXTAREA>
<BR><BR>
<INPUT TYPE=SUBMIT VALUE="Execute query!">
</FORM>
<?php
}
if ($action=="run") {
$query = stripSlashes($query) ;
$result = mysql_query($query);
?>
Results of query <B><?php echo($query); ?></B><HR>
<?php
if ($result == 0):
echo("<B>Error " . mysql_errno() . ": " . mysql_error() . "</B>");
elseif (mysql_num_rows($result) == 0):
echo("<B>Query executed successfully!</B>");
else:
?>
<TABLE BORDER=1>
<THEAD>
<TR>
<?php
for ($i = 0; $i < mysql_num_fields($result); $i++) {
echo("<TH>" . mysql_field_name($result,$i) . "</TH>");
}
?>
</TR>
</THEAD>
<TBODY>
<?php
for ($i = 0; $i < mysql_num_rows($result); $i++) {
echo("<TR>");
$row_array = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++) {
echo("<TD>" . $row_array[$j] . "</TD>");
}
echo("</TR>");
}
?>
</TBODY>
</TABLE>
<?php
endif;
}
?>
But now I have a question:
You made a link to
mysqlstatus.php!
Can you give the source of this file?