PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > wild card ` too wild `
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
wild card ` too wild `

Réponse
 
LinkBack Outils de la discussion
Vieux 01/05/2008, 08h47   #1
Marty
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut wild card ` too wild `

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>";
  Réponse avec citation
Vieux 01/05/2008, 09h42   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wild card ` too wild `

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
  Réponse avec citation
Vieux 01/05/2008, 10h10   #3
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wild card ` too wild `

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.
  Réponse avec citation
Vieux 01/05/2008, 12h37   #4
macca
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wild card ` too wild `


> 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.
  Réponse avec citation
Vieux 01/05/2008, 13h29   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wild card ` too wild `

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
==================

  Réponse avec citation
Vieux 01/05/2008, 13h38   #6
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wild card ` too wild `

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 ?
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h15.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15698 seconds with 14 queries