|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi pehaps you can , 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 server. my question: how do i modify it so that if i punch in say the vowel a 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 within. thanking you in advance, Marty. $SearchString=$_POST["SearchString"]; // Get the search tearm If($SearchString == "") $SearchString=$_GET["SearchString"]; the search tearm If($SearchString == "") { Echo"Nothing to Search For"; exit(); } $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>"; |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Thu, 01 May 2008 09:47:36 +0200, Marty <Marty.de.Porres@gmail.com>
wrote: > my question: how do i modify it so that if i punch in say the vowel > a > 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 > within. > $SearchResult=mysql_query("SELECT * FROM Articles WHERE ArticleTitle > LIKE '%$SearchString%' ORDER BY ArticleTitle") or die(mysql_error()); LIKE '$SearchString%' -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 1 May, 08:47, Marty <Marty.de.Por...@gmail.com> wrote:
> hi pehaps you can , 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 > server. > > my question: how do i modify it so that if i punch in say the vowel > a > 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 > within. > > thanking you in advance, > Marty. > > $SearchString=$_POST["SearchString"]; // Get the search tearm > If($SearchString == "") $SearchString=$_GET["SearchString"]; > the search tearm > If($SearchString == "") { > Echo"Nothing to Search For"; > exit(); > > } > > $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>"; At this level of lack of knowledge, you really ought to start reading the manual. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> At this level of lack of knowledge, you really ought to start reading > the manual. You don't half like spouting that comment every chance you get don't you? 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 people than tell them to RTM all the time. p.s - I'm not looking to start an argument here, it's just a suggestion. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
macca wrote:
>> At this level of lack of knowledge, you really ought to start reading >> the manual. > > You don't half like spouting that comment every chance you get don't > you? > > 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 > people than tell them to RTM all the time. > > > p.s - I'm not looking to start an argument here, it's just a > suggestion. > 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. ing 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. jstucklex@attglobal.net ================== |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 1 May, 12:37, macca <ptmcna...@googlemail.com> wrote:
> > At this level of lack of knowledge, you really ought to start reading > > the manual. > > You don't half like spouting that comment every chance you get don't > you? > > 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 > people than tell them to RTM all the time. 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 people". It would have been no for me to repeat Rik's answer. Instead I offered good advice to the OP, to them develop. Now, how did YOUR post ? |
|
![]() |
| Outils de la discussion | |
|
|