RE: [PHP-DB] Can't use field names in print
| From: | Beau Lebens | Date: | Mon, 14 Jan 2002 02:26:57 +0000 |
| Subject: | RE: [PHP-DB] Can't use field names in print | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15742@lists.php.net to get a copy of this message | ||
you should be able to just change the mysql_fetch_row to a mysql_fetch_array
and then use the names rather than the numbers in your print (modified
below, not tested :)
// <?
// $user = "root";
// $pw = "";
// $db = "pete";
//
// $mysql_access = mysql_connect("localhost", $user, $pw);
// mysql_select_db($db, $mysql_access);
//
// $result = mysql_query("select test2,test1,id from test",
// $mysql_access);
// while($row = mysql_fetch_array($result))
// {
// print($row["field1"] . " - " . $row["field2"] . " - " .
$row["field3"]
. "<br>");
// }
// ?>
/beau