Location: PHPKode > projects > AlkalinePHP > viewtable.php
<?
include("identify.php");
load_all("viewtable",10);
?>

<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>View Table</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="<? echo "$theme_bgcolor"; ?>" text="<? echo "$theme_text_color"; ?>">

<?
//include("levelten.inc");

$sql = "select version()";
$result = @mysql_query($sql, $main_settings->connection) or die("Couldn't execute query.");
$mysql_ver = mysql_fetch_array($result);

topheader();
echo "<center><b>Database Manager (Ver $ver_database)</b></center>";
botheader();

$tables = mysql_list_tables($database);
$num = mysql_num_rows($tables);

$table_num = 0; ?>
	


<?
topcontent();
echo "<p class=\"group\">";
echo "(Running on server: <i><a href=\"databases.php\">$server</a></i> | Database: <i><a href=\"databases.php\">$database</a></i> | Table: <i>$table_name</i><br>";
echo " using MySQL Ver: $mysql_ver[0])";
echo "</p>";

$new_width = $theme_table_width - 20;
?>
<table align=center>
	<tr>
		<td>
			 <? echo "<div style=\"width:$new_width; height:450;overflow:auto;\" align=center>\n";?>
              <table border="0" cellspacing="0" cellpadding="0"  height=350>
                <tr valign="top" > 
                  <td>
<?

	$sql = "
		SELECT *
		FROM $table_name
	";
	$result = @mysql_query($sql, $main_settings->connection) or die("Couldn't execute query.");
	$row_num = mysql_num_rows($result);
		

	while ($row = mysql_fetch_array($result)) {
		if (sizeof($names) < count(array_keys($row))) {
			$names = array_keys($row);
		}

		$col_num = (count($names) / 2) - 1;

		for ($i = 0; $i <= $col_num; $i = $i + 1) {
			$temp = $row[$i];
			$temp = htmlspecialchars($temp);
			if (strlen($temp) > 15) {
				$temp = substr($temp, 0, 15);
				$temp = "$temp...";
			}

			if ($temp == "") {
				$temp = "<font color=\"$theme_table_header_color\">[empty]</font>";
			}
			
			$block .= "<td class=\"border\" align=center>$temp </td> \n";
		}
		$block .= "<td class=\"border\" align=center>[drop] </td> \n";
		$block .= "</tr>";
	}

	echo "<table class=\"list\" align=center><tr>";
	
	for ($j = 1; $j <= count($names); $j = $j + 2) {
		echo "<th>$names[$j]</th>\n";
	}
	echo "<th bgcolor=$theme_table_header_color>[Options]</th>\n";
	echo "<tr>";
	echo "$block";

	echo "</table></table>"; ?>

			</td>
			</tr>
		</table>
		</div>
		</td>
	</tr>
</table></table>

<?
	echo "<p class=\"group\">";
	echo "---Options---<br>\n";
	echo "[<a href=\"deletetable.php?table_name=$table_name\">Delete table</a>]<br>\n";
	echo "</p>";

	echo "<form class=\"test\" action=\"addfield.php?table=$table_name\" method=\"post\">\n";

	echo "Add <input type=\"text\" name=\"new_col\" size=\"10\" maxlength=\"40\"> field ";
	echo "<select name=\"col_name\">";
	for ($j = 1; $j <= count($names); $j = $j + 2) {
		echo "<option value=\"$names[$j]\">After $names[$j]</option>\n";
	}
	echo "</select>\n";
	echo " of type <select name=\"field_type\">
		<option value=\"char\">char</option>
		<option value=\"date\">date</option>
		<option value=\"float\">float</option>
		<option value=\"tinyint\">tinyint</option>
		<option value=\"smallint\">smallint</option>
		<option value=\"mediumint\">mediumint</option>
		<option value=\"int\">int</option>
		<option value=\"bigint\">bigint</option>
		<option value=\"float\">float</option>
		<option value=\"double\">double</option>
		<option value=\"decimal\">decimal</option>
		<option value=\"date\">date</option>
		<option value=\"datetime\">datetime</option>
		<option value=\"timestamp\">timestamp</option>
		<option value=\"time\">time</option>
		<option value=\"year\">year</option>
		<option value=\"tinyblob\">tinyblob</option>
		<option value=\"tinytext\">tinytext</option>
		<option value=\"blob\">blob</option>
		<option value=\"mediumblob\">mediumblob</option>
		<option value=\"mediumtext\">mediumtext</option>
		<option value=\"longblob\">longblob</option>
		<option value=\"longtext\">longtext</option>
		<option value=\"enum\">enum</option>
		<option value=\"set\">set</option>
		<option value=\"text\">text</option>
		<option value=\"varchar\">varchar</option>
		</select>";
	echo "<input type=\"submit\" value=\"Create\">";
	echo "</form><br>\n";

	

	echo "<br><center>Return to <a href=\"databases.php\">databases</a> page</center>";
botcontent();
include("botpage.inc");
?>

</body>

</html>
Return current item: AlkalinePHP