addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Re: [php-49] WHERE LIKE IN ($array)

From: Jd D.
Sent on: Wednesday, January 23, 2013, 12:44 PM
So um... why LIKE? Shouldn't if be

$hashes = implode(',', $hashArray);
$q = "SELECT FIND_IN_SET('post_text', $hashes)";

or some shenanigans?


On Wed, Jan 23, 2013 at 12:37 PM, Tim Piele <[address removed]> wrote:
That's what I suggested but the boss didn't want to deal with it. We'd have to extract every hashtag from every post and store them, then do the lookup. 

I was using fulltext but it pukes on hashtags



On Wed, Jan 23, 2013 at 12:12 PM, Jd Daniel <[address removed]> wrote:
I don't think you'd want to use LIKE here anyway,
that seems like a recipe for failure =( Why not a
lookup table?


On Wed, Jan 23, 2013 at 11:42 AM, Mark Steudel <[address removed]> wrote:
I don't think you can do LIKE IN but I think you could do something like:

$sql = "SELECT fields FROM table WHERE field REGEXP '" . implode( '|', $hashtags ) . "'; 

I have no idea how this would work performance wise with large amounts of data ...


On Wed, Jan 23, 2013 at 11:36 AM, Tim Piele <[address removed]> wrote:
wuuuuut... man.

Hey JD while I've got you on the phone.... 

I haz regex that pulls out all of the hashtags in a string into an array.

$against = "#foo #bar #beeque";

$hashtags = array();
preg_match_all('/(?:^|\s+)(#\w+)/', $against, $hashtags);

Other than iterating over the array of hashtags and building a string of ANDs, is there a slick way to 
use LIKE and IN together?

Something like:

AND post_text LIKE '%IN($hashtags[0])'


o_O




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Tim Piele ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Tim Piele, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]



--
-----------------------------------------
Mark Steudel
P: [masked]
F: [masked]
[address removed]

. : Adoption Updates : .
http://www.steudel.org/blog

. : Work : .
http://www.mindfulinteractive.com

. : LinkedIn : .
http://www.linkedin.com/in/steudel




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Mark Steudel ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Mark Steudel, visit his/her member profile



--
Jd Daniel
Sr. Zend Developer
7901 Delridge Way SW #36D, Seattle

C.    [masked]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jd Daniel ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Jd Daniel, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Tim Piele ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Tim Piele, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]



--
Jd Daniel
Sr. Zend Developer
7901 Delridge Way SW #36D, Seattle

C.   [masked]

People in this
group are also in: