Is This Correct

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 19, 2011   (RSS)

By Joseph - January 18, 2011

Hi Guys
1. I am trying to create an A to Z list of artist and wanted to know if what i have below is the most efficient way of doing it.
2. For some reason i am unable to sort the list by certain letters which include - e, f, i, l, o, p, r & s. When i do select any of those letters i get the full list of artists. Joseph

code:
<span class="cgSectionHeaderBlue">
<a href="http://www.socanews.com/artists/index2.php?category_keyword=A">A</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=B">B</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=C">C</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=D">D</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=e">E</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=f">F</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=g">G</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=h">H</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=i">I</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=j">J</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=k">K</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=l">L</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=m">M</a>
<a href=[url "http://www.socanews.com/artists/index2.php?category_keyword=n">N</a><a href="]http://www.socanews.com/artists/index2.php?category_keyword=n">N</a>
<a href=[/#5b5745][/url]http://www.socanews.com/artists/index2.php?category_keyword=o">O</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=p">P</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=q">Q</a>
<a href=[url "http://www.socanews.com/artists/index2.php?category_keyword=r">R</a><a href="]http://www.socanews.com/artists/index2.php?category_keyword=r">R</a>
<a href=[/#5b5745][/url]http://www.socanews.com/artists/index2.php?category_keyword=s">S</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=t">T</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=u">U</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=v">V</a>
<a href=[url "http://www.socanews.com/artists/index2.php?category_keyword=w">W</a><a href="]http://www.socanews.com/artists/index2.php?category_keyword=w">W</a>
<a href=[/#5b5745][/url]http://www.socanews.com/artists/index2.php?category_keyword=x">X</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=y">Y</a>
<a href="http://www.socanews.com/artists/index2.php?category_keyword=z">Z</a>
</span>

Re: [socanews] Is This Correct

By Jason - January 19, 2011

Hi,

What's happening here is that you're storing 2 values in your category field, "Profiles" and a letter. The _keywords search looks for an instance of that character in the field. If you look at the letters that are returning all the results, they're all letters in the word "profiles".

What you can do is create your where clause manually to only look a the second value, not the profiles part. Try this:

list($artistsRecords, $artistsMetaData) = getRecords(array(
'tableName' => 'artists',
'allowSearch' => false,

'where' => "category LIKE '%\t".@$_REQUEST['category_keyword']."\t'",
));

Hope this helps.

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/