Different results between MySQL and PHP using the LIKE operator -
i trying create search bar on website search users name. when using mysql on database code works fine when use on website results not same.
select * `users` username '%neva%'
this returns user named nevada.
when try on site this.
$friendquery = "neva" if(isset($_get['friendquery']) && $_get['friendquery'] != ""){ $friendquery = preg_replace("/[^0-9a-za-z ]/", "", $_get['friendquery']); $friendquery = htmlentities($friendquery); $sql = "select * users username '%$friendquery%'"; $query = mysqli_query($db_connect, $sql); $u = $row["username"]; echo $u;
any great thanks
Comments
Post a Comment