I’m trying to create a page where users can search through all the records of a particular model, in my case albums. In the view I use:
for ($i = 65; $i < 90; $i++) {
echo $html->link(chr($i), array('action' => 'letter_find', chr($i))) , ' - ';
}
to print out each letter of the alphabet followed by a ‘-‘ (can anyone tell me how not to have the ‘-‘ after the last letter?). The user clicks on a letter and is passed to the letter_find action with the appropriate letter passed as a variable.
Here’s where I get stuck. I’m not completely sure how I’m meant to find all the albums beginning with the selected letter. Like I said in the title, I’m a total neub. This is probably something very simple to do?
thanks in advance 🙂
I think this should do it, and it will return the $results as an array: