I think you want the wildcard characters, % and _, to be within the variable, not within the variable name. For example, if you are looking for all advertisers whose name begins with 'A' followed by zero or more unknown characters, you would set your variable equal to this pattern [I don't know PHP so if this isn't how a variable declaration would look in PHP, adjust it so it does]:
 
    myVar = 'A%'
 
Then, you would execute your query, plugging in the variable in the appropriate place [again, I don't know PHP so maybe you need a $myVar instead of :myVar or at least something along those lines]:
 
    select *
    from  mytable
    where advertiser = :myVar
 
In your question, you seem to want to put the wildcard character(s) in the variable name like this:
 
    select *
    from mytable
    where advertiser = % :myVar
 
While this might conceivably work in some programming languages, it's not the way it is normally done in any language I know.
 
Rhino
 
----- Original Message -----
To: Mysql
Sent: Sunday, May 01, 2005 4:27 PM
Subject: Can I use LIKE this way?

  {
         $dead_beat_ads = "Delete from fsearch_temp where fsearchKeyword='$str' and fsearchTime='$time' and fsearchIp='$fbip' and fsearchHost LIKE '%$dbad%' ";
      $dead_beat_result = $dbi->query($dead_beat_ads);
  }
 
What I am doing is eliminate "Run of site" advertisers from our network  LIKE EBAY.com  I would rather give free crawler results than to allow this spam advertising anymore.  So I before I develope our XML output of search results to our partners I am going to remove them but since their tracking can change All I want to do is search for them by host  Like ebay.com  and I will pull this out in real time thus all the $time requirements.  This will mean that no matter which of our partners ebay buys advertising from they won't be displayed through our network.  Or if someone buys a commission junciton ad we will pull them out by the host even though the click url may be a qcksrv ad.
 
So the question is can that % be butted up against the variable or should I put a space in there.   While reading the LIKE on Mysql .com it talks about 2nd position with a space but I didn't know if that meant for the use of %_$dbad_% or if % $dbad % would have it looking for second position stuff.

 

Thanks
Donny Lairson
President
29 GunMuse Lane
P.O. box 166
Lakewood NM 88254
http://www.gunmuse.com
469 228 2183


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 29/04/2005
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 29/04/2005

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to