wild card ` too wild `

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi pehaps you can help, fairly new to php and mysql.
include below is an excerpt of a script that i've been using and runs
well on  5.2.5 php version and 5.0.51 mysql  version on an apache

my question:  how do i modify it so  that if i punch in say the vowel
 i'll get a return of  articleTitle(s) beginning with that vowel only
and not
an extensive list of articleTitles containing the vowel a anywhere

thanking you in advance,

 $SearchString=$_POST["SearchString"]; // Get the search tearm
If($SearchString == "") $SearchString=$_GET["SearchString"];
the search tearm
If($SearchString == "") {
Echo"Nothing to Search For";


$SearchResult=mysql_query("SELECT * FROM Articles WHERE ArticleTitle
LIKE '%$SearchString%' ORDER BY ArticleTitle") or die(mysql_error());

While($row = mysql_fetch_object($SearchResult)) {
Echo $row->ArticleTitle . "<BR>";

Re: wild card ` too wild `

Quoted text here. Click to load it

LIKE '$SearchString%'
-- =

Rik Wasmus

Re: wild card ` too wild `

Quoted text here. Click to load it

At this level of lack of knowledge, you really ought to start reading
the manual.

Re: wild card ` too wild `

Quoted text here. Click to load it

You don't half like spouting that comment every chance you get don't

Don't get me wrong, of course I appreciate reading the manual would
stop some posts like this one, but sometimes it's just easier to HELP
people than tell them to RTM all the time.

p.s - I'm not looking to start an argument here, it's just a

Re: wild card ` too wild `

macca wrote:
Quoted text here. Click to load it

Sorry, I'm with Paul.  There are many people who find it easier to ask
questions here, and it doesn't cost anything.  Reading the manual takes
too much effort.

Helping them with stuff that's easily found in the manual just
encourages them to post more - and wastes EVERYBODY else's time to read,
even if they don't respond.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: wild card ` too wild `

Quoted text here. Click to load it

The reason I posted it this time (and in a quite pleasant way I think)
is that the OP demonstrated such a complete lack of knowledge of SQL,
so much so that starting from scratch with the manual seemed to me to
be the thing that would most benefit them.

Rik had already given the answer to the specific question, so what
would have been the point of me answering the same question again?

You say "sometimes it's just easier to HELP people". It would have
been no help for me to repeat Rik's answer. Instead I offered good
advice to the OP, to help them develop.

Now, how did YOUR post help?

Site Timeline