Page 1 of 1

ORDER BY problem

Posted: Wed Jun 14, 2006 9:24 am
by Addos
http://www.tyre-tyre.com/search_instructor.php?idfk=29

I have a page here where “lives in this County” is run from the following query and is highlighted in red:

Code: Select all

<?PHP  if ($row_GetTrainers['inCounty'] != $row_DisplayLocation['location'])
echo '- services this County.' ;?>		
<?PHP  if ($row_GetTrainers['inCounty'] == $row_DisplayLocation['location'])
 echo '<span class="location">'.'- lives in this County.'.'</span>' ;?>
What I need is to have any of the specific names with - lives in this County to come up first on the page. Basically I need to run something like ‘ORDER BY’ however I don’t seem to be able to do this within the constraints of the code above. Is it possible to add something to the script above so that if any of the names are returned from the database in red they will come up listed first on the page. If you check out other locations you will see a little more of what I mean.
Thanks for any help and if necessary I can post more code.
Many thanks
Brian

Posted: Wed Jun 14, 2006 10:46 am
by lettie
Quick solution would be to add a column to your database called lives. Enter a number in the column where if they live in the county its '1' if they service the county its '2' then 'ORDER BY' lives either ascending or descending depending on what you want.