Php MySQL case sensitive -
i know question has been asked before. nothing seems work me.
so have code below. trying search in database table product_description , column name (this part far works).the column name's collation utf8_general_ci
$searchword1 = "squirl"; $existingword1 = "banana"; $replacerword1 = "orange"; i have 3 products:
name: squirl banana pie name: squirl banana pie name: squirl banana pie i want search squirl,the search should grab both squirl , squirl. same goes banana $existingword1 banana , should search banana
$sql1 = "update product_description set name = replace(name, '$existingword1', '$replacerword1') name '%$searchword1%';"; if ($conn->query($sql1) === true) { echo "<h1>everything worked planned</h1>"; } else { echo "error updating record: " . $conn->error; } i read several posts on stackoverflow , nothing helped me far.
i don't know if it's me i'm not sure understand question.
if want sure find items want regardless of case, can use mysql functions named upper(...) , lower(...) allow convert string in uppercase or lowercase respectively
for example :
select name product_description lower(name) = 'squirl'; will match both squirl, squirl or squirl
Comments
Post a Comment