ok so now that I am moving back along with my 6.x development I am stumped on an odd issue. I have some pages setup to for my _menu:

function whootisnet_sites_menu() {

  $items = array();

  //this was created earlier in tutorial 7.
  $items['admin/settings/whootisnet_sites'] = array(
    'title' => 'Whootis.net Sites module settings',
    'description' => 'Settings for the interface that users use to manage thier sites.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('whootisnet_sites_admin'),
    'access arguments' => array('administer whootisnet_sites'),
    'type' => MENU_NORMAL_ITEM,
   );

  //this is added for this current tutorial.
  $items['mysites'] = array(
    'title' => 'My Hosted Sites',
    'page callback' => 'whootisnet_sites_show_sites_by_user',
    'access arguments' => array('manage own sites'),
    'type' => MENU_NORMAL_ITEM
  );

  return $items;
}

great. When I hit /mysites it calls the callback fine:

function whootisnet_sites_show_sites_by_user( $op='list' ) 
{
	global $user;
	$node_content = '';
	
	// If no value is passed, just list the available sites.  Otherwise we accept an ID representing the site
	if( $op == 'list' )
	{
		$sites = db_query("SELECT * FROM domains WHERE userid = '%s'", $user->name);

		while ($site = db_fetch_object($sites)) 
		{
			$node_content .= "<p>".l( $site->name, 'mysites/'.$site->id )."</p>";
		}		
	}
	else
	{
		// Only if the value passed is an integer value representing the ID, otherwise ignore it
		if ( (int)$op )
		{
			$result = db_query("SELECT id,name FROM domains WHERE userid = '%s' AND id = %d LIMIT 1", $user->name, (int)$op);
			
			if ( $site = db_fetch_object($result) )
			{
				$node_content .= "<p>".$site->name."</p>";
				
				$subs = db_query("SELECT name FROM records WHERE domain_id = '%d' AND type = 'A'", (int)$site->id);
				
				while ($sub = db_fetch_object($subs)) 
				{
					$node_content .= $node_content .= $sub->name."<br>";
				}
			}
		}
	}

	return $node_content;	
}

On the initial page of /mysites it populates the list just fine with sites associated with my account:

My Hosted Sites

test1.com

test2.com

test3.com

test4.com

test5.com

test6.com

However if I click on one of the links to go to the edit page of that site I get this:

My Hosted Sites
starting

test1.com
www.test1.com
starting

test1.com
www.test1.com
ftp.test1.com
starting

test1.com
www.test1.com
starting

test1.com
www.test1.com
ftp.test1.com

The query clearly runs multiple times and seems to terminate early for half of them. Anyone got any ideas?

Comments

TheGorf’s picture

omg... another case of staring at things for too long. The query doesn't run multiple times. Instead I copied and pasted a dang line in correctly:

$node_content .= $node_content .= $sub->name."
";