RE: [PHP] ODBC text file connection problem
| From: | Ethan Nelson | Date: | Tue, 10 Sep 2002 19:41:26 +0000 |
| Subject: | RE: [PHP] ODBC text file connection problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115885@lists.php.net to get a copy of this message | ||
So this code:
$odbc = odbc_connect("cvalcoinput","","") OR die("There is an
error connecting to the CSV file.");
$result = odbc_tables($odbc);
while(odbc_fetch_into($result, $fields)){
for ($i = 0; $i < sizeof($fields); $i++) {
echo $fields[$i] . "<br>";
}
}
Derives the following results:
D:\INETPUB\CVALCO\INCLUDE\INPUT
inputfile.txt
TABLE
Which makes sense. Those are the contents of the array returned by odbc_tables. Now try to use
odbc_exec and I run into my problems. This article on the microsoft KB seems to suggest under
"text driver limitations" that I should be able to run select statements using the
odbc_exec command.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q178717
Anyone know of any really good ODBC resources?
-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
Sent: Tuesday, September 10, 2002 12:29 PM
To: Ethan Nelson; php-general@lists.php.net
Subject: RE: [PHP] ODBC text file connection problem
[snip]
// ODBC commands to explore connection:
$result = odbc_tables($odbc);
odbc_fetch_into($result,$row);
print_r($row);
[/snip]
Have you tried a WHILE loop to print out each row? I am not sure of the exact syntax but something
like;
<?php
while(odbc_fetch_into($result, &$fields)){
print($fields[0]);
print($fields[1]);
// and so on ...
print("<br>\n"); //at end of row
}
?>
Jay
*****************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* Contact jay.blanchard@niicommunications.com *
* *
* Want to present a paper or workshop? Contact now! *
*****************************************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php