Io faccio così.
Codice PHP:
//estrae tutte le tabelle
//$sql ="select name from [db]..sysobjects where xtype = 'U'order by name";
//estrae tutte le tabelle che iniziano con "Telephony"
<?php
$sql = "SELECT name FROM sysobjects WHERE xtype = 'U' AND name LIKE 'Telephony%' ORDER BY name";
// processi la stringa
$result = mssql_query($sql);
//verifichi il risultato se diverso da 0. Se fallisce significa che non ci sono tabelle nel db
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MSSQL ERROR: '.mssql_get_last_message();
exit;
}
?>
<
<table height="15px">
</table>
<td width="450px"bgcolor="silver"><font face="Arial,sans-serif" color=black><font style="font size=13"><form name="nome" method="post" action="test.php">
[b]Select Account: [/b] <select name="nome" onChange="submit()">
<option value=""></option>
ss
<?php
// cicli per estrarre tutti i nomi delle tabelle e crei direttamente il form di scelta.
while ($row = mssql_fetch_row($result)) {
echo "<option value=\"".$row[0]."\">".$row[0]."</option>";
}
mssql_free_result($result);
?>
Però sono alle prime armi, probabilmente ci sono metodi migliori