How do I select all rows from my database that have a value that is part of a certain string?


I have a loop that is producing a string like $sku = MAR-9-870-2-L. I have a database that is a list of "skusearchquery" that often look like skusearchquery = MAR-9. I am trying to do a search for all rows of the database that have a skusearchquery contained inside the string $sku.

I know the code below doesn't work because MAR-9-870-20-L is NOT LIKE MAR-9-870 because MAR-9-870 doesn't contain the longer string so I'm wondering how I can say: if the row value skusearchquery matches part of the string MAR-9-870-20-L then select it.

$search = mysqli_query($connect