Welcome Guest, Not a member yet? Register   Sign In
How can i get single value without foreach
#4

[eluser]onejaguar[/eluser]
I created a helper function to do this for me:

Code:
//
// Return database results with a single value
//
function db_pop(&$result) {
  if ($result->num_rows() == 1)
    return array_pop($result->row_array());
  return null;
}

just call with

Code:
echo db_pop($query);


Messages In This Thread
How can i get single value without foreach - by El Forum - 07-10-2008, 11:44 PM
How can i get single value without foreach - by El Forum - 07-11-2008, 12:16 AM
How can i get single value without foreach - by El Forum - 07-11-2008, 09:04 AM
How can i get single value without foreach - by El Forum - 07-11-2008, 10:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB