Alphabetical pagination

From: Date: Tue, 14 Jul 2009 19:38:23 +0000
Subject: Alphabetical pagination
Groups: php.general 
Request: Send a blank email to php-general+get-295384@lists.php.net to get a copy of this message
I am trying to make a page that displays a-z like a b c d e etc as links then when you click open one it reloads itself and shows only the query results that go with that letter...i'm not getting it....I get a page that says ARRAY over and over... What I have so far: <?php if(!isset($_SESSION['RestaurantList'])) { // List not grabbed yet, so run query and store in $_SESSION $sql = "SELECT DISTINCT name FROM restaurants GROUP BY name DESC"; $result = mysql_query($sql) or die(mysql_error()) ; $count = mysql_num_rows($result); echo $count; while($row = mysql_fetch_array($result)) { $name=array($row['name'],0,1); //$name = array('name'); echo "<a href=\"page.php?name=" .$name. "\"> $name</a>\n"; } } $alphabet = range('A', 'Z'); foreach ($alphabet as $letter) { echo '<a href="' . $_SERVER['PHP_SELF'] . '?letter=' . $letter . '">' . $letter . '</a>'; } ?>

« previous php.general (#295384) next »