Voting

: max(one, zero)?
(Example: nine)

The Note You're Voting On

Remy
20 years ago
I use this function to get my recordset in an array, and it's very easy to use.

function dbquery($sql) {
$arr = array();
$conn = odbc_connect('dsn','user','pass');
$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:

$arr=dbquery("SELECT * FROM tblTable");
echo $arr[1][1] //echo's first column of the first row

<< Back to user notes page

To Top