Jump to content

Query in class stops when nesting another query


djones

Recommended Posts

For some reason the nested query is stopping the parent from completing. What am I over looking?

Of course this is not the actual query but an example that fails too.

 

public function list_stuff(){

	$sql = "SELECT id FROM project";

	$this->query($sql);

	while ($row = $this->rs->fetch_assoc()) {


		echo $row['id'].'<br />';
		echo $this->pull_more_stuff($row['id']).'<br />';

	}


}

public function pull_more_stuff($id){

	$sql = "SELECT project_name FROM project WHERE id = '".$id."'";
	$this->query($sql);

	$row = $this->rs->fetch_row();

	return $row[0];	


}

 

If I comment out

echo $this->pull_more_stuff($row['id']).'<br />';

 

the parent query will complete and I will get the results (project ids):

1

2

3

 

When I leave that line in I get:

1

Project Name

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.