note 62336 added to function.odbc-fetch-array
| From: | craig at ozbackup dot net dot au | Date: | Sat, 25 Feb 2006 11:55:43 +0000 |
| Subject: | note 62336 added to function.odbc-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104418@lists.php.net to get a copy of this message | ||
for some reason the following code seams to work but returns nothing.
[code]
$username = $clientinfo_row[6];
function dbquery($sql) {
$arr = array();
$conn = odbc_connect('DB_name','','');
$rs = odbc_exec($conn,$sql);
$x = 1;
while (odbc_fetch_row($rs)) {
for ($y = 1; $y <= odbc_num_fields($rs); $y++)
$arr[$x][$y] = odbc_result($rs,$y);
$x++;
}
if ($x > 1)
return $arr;
}
//usage:
$dbsel = sprintf(
"SELECT UserId FROM Users WHERE Users.UserName = '%s'", $username);
$arr=dbquery($dbsel);
echo $arr[1][1]."<br>";//echo's first column of the first row
echo $arr[1][2]."<br>";
[/code]
I believe it has something to do with sprintf line? Even tho echoing it returns the right SELECT
statement.
any help would rock thanx
----
Server IP: 203.16.234.20
Probable Submitter: 202.7.176.130 (proxied: 220.245.140.156)
----
Manual Page -- http://www.php.net/manual/en/function.odbc-fetch-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62336
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62336&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62336&report=yes
Search -- http://master.php.net/manage/user-notes.php