Jump to content

Recommended Posts

Hello,

 

I have this sql code that pulls out member details from a table

 

public function getMemberAndLocationByName($name)
{
	$db = Zend_Registry::get('db');
	$name = $db->quote($name);
	$name = $name;
	$new_name = preg_replace("/[^a-zA-Z0-9s]/", "", $name);		
	$sql = "SELECT $this->_name.*, locations.name as location from $this->_name LEFT JOIN locations on $this->_name.restaurant_id = locations.id where $this->_name.name LIKE '%$new_name%'";
	//die($sql);
	$query = $db->query($sql);
	while ($row = $query->fetch()) {
    		$result[] = $row;
	}

	//die(print_r($result));
	return $result;


}

 

how do i then using oo and PHP5 print all the results on screen?

 

Thanks

I dont totally understand you, BUT, you can try this:

 

$DB = new DB; #Change DB to the class that the function is contained in;

$name = "blah";

$result = $DB->getMemberAndLocationByName($name);

print_r($result);
//You can use a loop instead of printing everything out in a oner.

 

I think thats your question solved;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.