Jump to content

abc 0-9 search


dose

Recommended Posts

Sorry if my title dont make sense. Im trying to pageinate by abc 0-9 and . ive got the abc part to work but i dont know how to include the 0-9 and the .

 

heres what i got.

 

$abc = htmlentities($_GET['abc']);
$a = "A";
$letters = range('A', 'Z');
$menu = '<ul class="submenu">'."\n";

foreach($letters as $letter)
{
	if($letter == "A")
	{
		$menu .= '<li class="first"><a href="/games/A">A</a></li>';
	}
	else
	{
		$menu .= '<li><a href="/games/'. $letter .'">'. $letter .'</a></li>';
	}
}

$menu .= '</ul>'."\n";

if(isset($abc) AND in_array($abc, $letters))
{
	$games = array();
	$result = $db->query("SELECT games.title, games.gameid FROM games WHERE title LIKE '". $abc ."%' GROUP BY title ORDER BY title ASC");

	while($array = $db->fetch($result))
	{
		$games[] = $array;
	}
}

Link to comment
https://forums.phpfreaks.com/topic/204631-abc-0-9-search/
Share on other sites

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.