GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Nov-2007, 09:14
ManOnScooter ManOnScooter is offline
New Member
 
Join Date: Nov 2007
Posts: 1
ManOnScooter is on a distinguished road

Pagination & DB search engine queries


I am trying pagination for a database-database search engine - this was the query

$sql = "select id, name from student_adv WHERE name LIKE '%$search%' order by id limit $startIndex, $perPage";
and it worked fine when i had
$search = John

The problem starts when i put $search = John Lennon

I modify my query to
$sql = "select id, name from student_adv WHERE name LIKE '%$search%' or name like '%$w1%' or name like '%$w2%' limit $startIndex, $perPage";

here
$search = John Lennon
$w1= John
$w2=Lennon

But, the result shows the presence in an order which is random, i.e. Lennon is in the result-set array before John Lennon or John,
But, I want the result set array to have John Lennon coming before John & John before Lennon..
So John Lennon Results come first then John and the Lennon

How do I do this??
 
 

Recent GIDBlogToyota - 2008 August Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Seo Tips And Tools dhsn98 Search Engine Optimization Forum 5 08-Apr-2008 19:12
Using meta tags help in ranking on some search engine pcx Search Engine Optimization Forum 8 29-Mar-2005 15:42
How a search engine really works (In english) jrobbio Open Discussion Forum 0 06-Jul-2003 17:13
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:08.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.