MyBB Community Forums

Full Version: doesn't return id 10 and up
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am making a feature for the admin to make a custom page.

For the edit and delete features I have a drop down box.
when I select ones that are before id 10 they display but id 10 and up don't.
I got the code from musicalmidgets links page (version 2).

function getcategories($cpid)
{
	global $db; $catselect;
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."custompage WHERE cpid ORDER BY cpid ASC");
	$catselect .= "<select name=\"category\"><option value=\"0\"";
	if($cpid == "0")
	{
		$catselect .= " selected>----------</option>";
	}
	else
	{
		$catselect .= ">----------</option>";
	}
	while($category = $db->fetch_array($query))
	{
		$catselect .= "<option value=\"{$category['cpid']}\"";
		if($category['cpid'] == $cpid)
		{
			$catselect .= " selected>".$category['title']."</option>";
		}
		else
		{
			$catselect .= ">".$category['title']."</option>";
		}
	}
	$catselect .= "</select>\n";
	return $catselect;
}