SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Keyword seach
-
Oct 9, 2004, 15:26 #1
- Join Date
- Jul 2003
- Location
- UK
- Posts
- 11
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Keyword seach
I am using this query to find particular items.
Code:$result = @mysql_query("SELECT * FROM submission WHERE day = '$subday' AND month = '$submonth' AND year = '$subyear'"); if (!$result) { die('<p>Unable to locate database. Script is at search level.</p>'); }
Code:$result = @mysql_query("SELECT * FROM submission WHERE subtext = '$subsearch'"); if (!$result) { die('<p>Unable to locate database. Script is at search level.</p>'); }
The simplest way to explain is that I want to seach for any entry that contains the value of $subsearch but not an exact match.
*$subsearch* - no matter what is before or what is after.
Does that make sense?
Lee
-
Oct 9, 2004, 15:35 #2
- Join Date
- Jul 2003
- Location
- UK
- Posts
- 11
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, so you look at things long enough and the answer get to your brain!!
the = sign should have given it away to me. Never mind.
So the code for those remotely interested should have been
Code:$result = @mysql_query("SELECT * FROM submission WHERE subtext LIKE '%$subsearch%'"); if (!$result) { die('<p>Unable to locate database. Script is at search level.</p>'); }
Bookmarks