note 62336 deleted from function.odbc-fetch-array by philip

From: Date: Sun, 21 Dec 2008 15:16:07 +0000
Subject: note 62336 deleted from function.odbc-fetch-array by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148421@lists.php.net to get a copy of this message
Note Submitter: craig at ozbackup dot net dot au ---- 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

« previous php.notes (#148421) next »