note 33842 deleted from function.mysql-result by didou

From: Date: Wed, 09 Jul 2003 08:06:05 +0000
Subject: note 33842 deleted from function.mysql-result by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51752@lists.php.net to get a copy of this message
Note Submitter: Paul Tarjan ---- Better code to display a query: $qry = mysql_query($_POST['sql']) or die(mysql_error()); print "<table border='1' width='100%'><tr>"; if (mysql_num_rows($qry) > 0) { for ($i = 0; $i<mysql_num_fields($qry); $i++) { echo "<th>" . mysql_field_name($qry, $i) . "</th>"; } } print "</tr>"; while ($row = mysql_fetch_row($qry)) { print "<tr>"; foreach ($row as $item) print "<td>$item</td>"; print "</tr>"; }

« previous php.notes (#51752) next »