foreach
| From: | Rose, Billy | Date: | Thu, 25 Apr 2002 16:44:27 +0000 |
| Subject: | foreach | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-83327@lists.php.net to get a copy of this message | ||
Environment:
Apache 2.0.35
PHP 4.2.0RC2
FreeTDS used in place of Sybase libraries to connect to MS SQL 2000
RedHat Linux 7.1
PII 233
Problem:
Using foreach retrieves a duplicate of each database column.
Code tested:
<html>
<head>
<title>Test</title>
</head>
<body>
<?
$link = sybase_connect($dbhost,$dbuser,$dbpass)
or die("Error connecting");
sybase_select_db($dbname)
or die("Error selecting database");
$result = sybase_query($query)
or die("Error running query");
print("<table border='0' width='100%' cellpadding='0'
cellspacing='4'>\n");
while ($row = sybase_fetch_array($result)) {
print("<tr>\n");
foreach ($row as $col) {
print("<td>".$col."</td>\n");
}
print("</tr>\n");
}
print("</table>\n");
sybase_free_result($result);
sybase_close($link);
?>
</body>
</html>
Is this a PHP issue, or a FreeTDS problem?
Billy Rose
wrose@loislaw.com