Re: Alphabetical pagination (RESOLVED)
| From: | Miller, Terion | Date: | Thu, 16 Jul 2009 13:33:19 +0000 |
| Subject: | Re: Alphabetical pagination (RESOLVED) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295459@lists.php.net to get a copy of this message | ||
Here is what finally worked:
<?php $letter =
isset($_GET['letter']) ? $_GET['letter'] : "A";
//alphabetical pagination links
echo '<div align="center"><b>';
foreach(range('A','Z') as $c){
($letter == $c)
? printf('%s ',$c)
: printf('<a href="?letter=%s">%s</a> ',$c,$c);
}
echo "</b></div><p>";
//Show all restaurants that
start with $letter $sql = "SELECT * FROM
restaurants WHERE name LIKE '{$letter}%'";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
printf('<div align="left"
width="100"><b>%s</b><br>%s</br>%s</br></div><hr
color=#000
width=200></hr>',$row['name'],$row['address'],$result['cviolations']);
}
?>
Thanks again everyone!!
On 7/15/09 10:48 AM, "tedd" <tedd.sperling@gmail.com> wrote:
At 8:29 AM -0700 7/15/09, Miller, Terion wrote:
>
>Hi all thanks for all the suggestions, I really had no idea this was
>going to be so difficult..
I think you are making it more difficult than it has to be.
Please review what I said and try it out.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php