View Single Post
Old 11-18-2021, 11:44 PM  
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Untested, and assuming your regex is correct.


domain.com/collection.php?keyword=chicken|garlic

$keywords = explode("|",$_GET['keyword']);
foreach($keywords as $i) {
$output[] = "(?=.*".mysqli_real_escape_string($con,$i).")" ;
}
$result = mysqli_query($con,"SELECT * FROM Recipe WHERE Ingredient REGEXP '".implode("",$output)."' ORDER BY RAND() LIMIT 10");
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote