I am trying to figure out a problem that I am having with this PHP section of code.
$connection = odbc_connect( $connection_string, $U, $P );
//GET THE WORKGROUP OF THE LOGGED ON USER
$USERID = strtoupper($_POST['USER']);
$sql = "SELECT FACILITY,WORKGROUP FROM CLUSER WHERE USERID = '$USERID' ";
$result = odbc_exec($connection, $sql);
$res_rows = odbc_result_all($result,'FACILITY');
// Want result to be stored as a variable
$FACILITY = $res_rows;
// echo the variable
When I run this in a debugger I get the following:
Name Value Type
$Facility 0 long
$res_rows 0 long
$result 3 odbc result
I have tried ODBC_RESULT as well with the same end result.
Problem. I notice when i remove in the SQL statement the variable '$USERID' that the debugger pulls information for both ODBC_RESULT and ODBC_RESULT_ALL. Why is the variable causing this issue.
This code is used to validate a user based on the facility and Workgroup so that they are able to view information dependent on those items.
I have been all over PHP.net and a few other places but to no avail. Any help on this would be great.