Jump to content

where clause help


MDanz

Recommended Posts

Instead of using a string or ORs, you can use IN(). Note the change to the glue in the implode() as well . . .

 

$scopetwo = implode("', '", $scope);
$getresults=mysql_query("SELECT * FROM message WHERE keywords IN ('$scopetwo') ORDER BY posted ASC",$this->connect);

Link to comment
https://forums.phpfreaks.com/topic/237027-where-clause-help/#findComment-1218314
Share on other sites

You may want to array_merge() the arrays before using implode. Then you can format the whole thing in one shot. Untested, but this should work.

 

$merged_scopes = array_merge( $scope, $scopepre );
$scopefinal = implode( "', '" ,$merged_scopes );

Link to comment
https://forums.phpfreaks.com/topic/237027-where-clause-help/#findComment-1218320
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.