Finally, there is, of course, also a way to retrieve all data in the resultset. A while loop comes into play, using one of these functions:
Retrieving Data from MSSQL/MSDE (mssql_fetch.php; excerpt)<table> <tr><th>#</th><th>Quote</th><th>Author</th><th>Year< /th></tr> <?php if ($db = @mssql_connect('localhost', 'user', 'password')) { mssql_select_db('phrasebook', $db); $result = mssql_query('SELECT * FROM quotes', $db); while ($row = mssql_fetch_assoc($result)) { printf( '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></ tr>', htmlspecialchars($row['id']), htmlspecialchars($row['quote']), htmlspecialchars($row['author']), htmlspecialchars($row['year']) ); } mssql_close($db); } else { echo '<tr><td colspan="4">Connection failed.</td></tr>'; } ?> </table> |