note 17473 added to ref.mssql

From: Date: Mon, 10 Dec 2001 19:52:24 +0000
Subject: note 17473 added to ref.mssql
Groups: php.notes 
Request: Send a blank email to php-notes+get-22451@lists.php.net to get a copy of this message
Here's a piece of code to make an HTML-formatted page of a database, suitable for printing or whatever: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Database Description</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"><!-- BODY{font: 10pt Courier;} TABLE{border:0; text-align: left;} TD{border-bottom: 1px solid black;}--> </style> </head> <body> <?php $conn = mssql_connect("server", "user", "password"); mssql_select_db("Database", $conn); $result = mssql_query("sp_help", $conn) or die(mssql_get_last_message()); while($row = mssql_fetch_row($result)) { if(substr($row[0], 0, 3) == "sys") continue; //Ignore MS sys tables. echo "<table><col width=200><col width=250><col width=110>"; echo "<tr><th>" . $row[0] . "</th></tr>\n"; $result2 = mssql_query("sp_columns @table_name = '" . $row[0] . "'", $conn); while($row2 = mssql_fetch_row($result2)) { printf(" <tr><td></td><td>%s</td><td>%s(%s)</td></tr>\n", $row2[3], $row2[5], $row2[6]); } echo "</table>\n"; } ?> </body> </html> -- http://www.php.net/manual/en/ref.mssql.php http://master.php.net/manage/user-notes.php?action=edit+17473 http://master.php.net/manage/user-notes.php?action=delete+17473 http://master.php.net/manage/user-notes.php?action=reject+17473

« previous php.notes (#22451) next »