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
Share on other sites

nevermind i found what i needed =) googles a life saver lol.. if anyone else needs to know this is what i did.

 

$result = $db->query("SELECT games.title, games.gameid FROM games WHERE title REGEXP '^[0-9\\.]' GROUP BY title ORDER BY title ASC");

Link to comment
Share on other sites

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.