odbc question
| From: | Adil | Date: | Tue, 16 Nov 2004 19:39:59 +0000 |
| Subject: | odbc question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202206@lists.php.net to get a copy of this message | ||
>$sql = "SELECT * FROM users WHERE username='$username' AND
password='$password'";
>$result = odbc_exec($dbConnection, $sql);
>
>while ($rows = odbc_fetch_array($result)) {
> //This doesn't work with odbc_fetch_object either
> print $rows->COLUMNNAME;
>}
It's returning an array, not an object (I can't speak as to how the
odbc_fetch_object function behaves - it seems poorly documented, but it
looks like you get back something more fancy than a simple object with
named variables).
In short, use odbc_fetch_array and refer to the items as
$rows["COLUMNNAME"] (or use single quotes).
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.