troubleshooting Question

How do I retrieve the individual results of an array?

Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on
4 Comments2 Solutions107 ViewsLast Modified:
Here's my function:

public function pref_reference() {

	global $mysqli;

	$sql="select, as pref_id, preferences.tool_id, preferences.tool_fields, tools.tool_name, from preferences inner join tools on where'$_GET[id]'";
			.'ERRNO: '
			.' QUERY: '
			trigger_error($err, E_USER_WARNING);

	return $result_array;

I want to retrieve from this array the email address and the tool id.

So, I've got this:

$new_tool = new ToolAdmin; //call my class

$reference=$new_tool->pref_reference(); // call the above method

Now I want to echo just the email address that's a part of this array. I've tried:

$reference['email_address'], $reference[0] and just about any other combo I can think of. I know I'm missing something, but I can't figure out what.

I know how to do a foreach, but is there a more direct way of just being able to reference specific values within the array?
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros