I would like to select rows which start with the word s
but I am getting other results as well. I have rows red socks
, blue sweater
, skirt
.... in the table and when I do the select as below I end up with the above result. I am guessing this is because the red socks contain s
on the second word, so how can I just select skirt
?
$pr = 's%'
$stmt = $db->prepare("SELECT * FROM table where product like ?");
$stmt->bind_param('s', $pr);
$stmt->execute();
rows returned
skirt
red socks
blue sweater
I only need skirt