10-17-2000, 10:00 PM
I know there are more feature packed MySQL administrators available and you can do a lot with them. These serve their place in managing and maintaining a database. Often times though the overhead associated with them is too much when you want to run a quick query or add a field from within vBulletin.
What I did is simply edit the Query TEST script in "Professional PHP Programming" to work with vBulletin.
At the bottom and before the </BODY> tag of index.php in your admin directory add:
<p><b>Database Management</b><br>
<a href="query.php?action=new">Query</a><br>
<a href="mysqlstatus.php">MySQL Stats</a><br>
Then create a file called query.php and add the following code:
<HTML>
<HEAD>
<TITLE>SQL Query</TITLE>
</HEAD>
<BODY>
<?php
require ("global.php");
if ($action=="new") {
?>
<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;
}
?>
</BODY>
</HTML>
The second link connects to J. Eng's Extended Status Script which is available in this forum.. Just do a search for it or look for Eva2000's signature.:)
What I did is simply edit the Query TEST script in "Professional PHP Programming" to work with vBulletin.
At the bottom and before the </BODY> tag of index.php in your admin directory add:
<p><b>Database Management</b><br>
<a href="query.php?action=new">Query</a><br>
<a href="mysqlstatus.php">MySQL Stats</a><br>
Then create a file called query.php and add the following code:
<HTML>
<HEAD>
<TITLE>SQL Query</TITLE>
</HEAD>
<BODY>
<?php
require ("global.php");
if ($action=="new") {
?>
<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;
}
?>
</BODY>
</HTML>
The second link connects to J. Eng's Extended Status Script which is available in this forum.. Just do a search for it or look for Eva2000's signature.:)