Jump to content

[SOLVED] Echo returned variable from function


adam291086

Recommended Posts

Here is the function

 

function get_template($domain,$account)
{
	require_once('DbConnector.php');
	$loginConnector = new DbConnector();

	$getTemplate = $loginConnector->query("SELECT * FROM Site_Info WHERE Domain = '$domain' AND account_number='$account'");
	$this->templatedata = $loginConnector->fetchArray($getTemplate);
	$temp = $this->templatedata['Id'];

	$getTemplate = $loginConnector->query("SELECT * FROM Template_Details WHERE Id = '$temp'");
	$this->templatedata = $loginConnector->fetchArray($getTemplate);
	$image = $this->templatedata['example_location'];
	return $image;
}

 

the variable $image does contain the correct data. Now i am trying to echo out the returned variable like

 

require_once ('../../code/cms.php');
$domain = $_SESSION['domain'];
$account = $_SESSION['account_number'];
$add = new cms();
$add ->get_template($domain,$account);
$image = $add;
echo $image;

 

But instead of the image location i get Object written on the page. The function is within a class which is initated correctly.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.