Bruce Gust
asked on
How do I retrieve a variable from this function?
Here's the code:
I'm more accustomed to a procedural context, hence my being lost. How do I write an if statement that determines whether or not if$data[$count]["rolename" ] -"developer"?
Thanks for you help!
if (!function_exists('ptl_approlepermissionlist_byapppermissionrefuser')) {
function ptl_approlepermissionlist_byapppermissionrefuser($apprefname,$userid) {
global $mdb,$_SESSION;
$data = array();
$sql_data = "exec ptl_AppRolePermissionList_byAppPermissionRefUser '$apprefname', $userid";
if ($_SESSION["portaladmin"] == 1 && $_SESSION["showsql"] != "no")
echo display_detail("functions_db.php",$sql_data);
$result_data = odbc_exec($mdb, $sql_data);
$count = 0;
while (odbc_fetch_row($result_data))
{
$count++;
$data[$count]["appid"] = odbc_result($result_data, "appid");
$data[$count]["apprefname"] = htmlspecialchars(odbc_result($result_data, "apprefname"), ENT_QUOTES);
$data[$count]["permissionid"] = odbc_result($result_data, "permissionid");
$data[$count]["permissionname"] = htmlspecialchars(odbc_result($result_data, "permissionname"), ENT_QUOTES);
$data[$count]["permissionrefname"] = htmlspecialchars(odbc_result($result_data, "permissionrefname"), ENT_QUOTES);
$data[$count]["roleid"] = odbc_result($result_data, "roleid");
$data[$count]["rolename"] = htmlspecialchars(odbc_result($result_data, "rolename"), ENT_QUOTES);
$data[$count]["rolerefname"] = htmlspecialchars(odbc_result($result_data, "rolerefname"), ENT_QUOTES);
$data[$data[$count]["permissionrefname"]]["allow"] = true;
}
$data["count"] = $count;
return $data;
}
}
I'm more accustomed to a procedural context, hence my being lost. How do I write an if statement that determines whether or not if$data[$count]["rolename"
Thanks for you help!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Chris, I didn't see you jumping in until after I had posted my comment. Thanks for helping out!
ASKER
Thanks for taking the time to weigh in. You are right, but there was some more "stuff" behind the scenes that I needed to understand in order for any of this to make sense.
BTW: This isn't my code. I'm a contract guy and I'm working right now just to get my head wrapped around what's current working / in place.
Here's what I learned:
The info I was looking for is not in the aforementioned function. Rather, it was in another stored procedure and instead of a situation where I was looking for something along the lines of $data[1]=="update" to determine if the user had the necessary permissions to update things, it was instead a two dimensional array and the resulting if statement looked like this: if ($appuserpermission["updat
Uncharted waters, major learning curve, but once I got my arms around it, I let out a big "Yes!" that un-nerved the entire floor that I'm working on.
There you have it!