php - Mysql LIKE show unknown characters -


i tried filter data mysql table.

<?php include ("connection.php"); $name = "cable"; $sql = "select  * stock item '%$name%'"; ?> <a target="_blank" href="test2.php?link=<?php echo $sql; ?>" >click</a> 

i tried sql statement using $_get[link] next page. (test2.php). here's code test2.php

<?php     include ("connection.php");    $link = $_get['link']; echo $link; 

then echo $link show me different value. doesn't display "cable". instead, displays

select * stock item 'Êble%' 

can tell me why cable became Êble ?

as ayyanar said, yes, not idea pass sql query in url.

but if still want achieve can this:

test1.php

<?php $name = "cable"; $sql = "select  * stock item '%--$name--%'"; ?> <a target="_blank" href="test2.php?link=<?php echo $sql; ?>" >click</a> 

test2.php

<?php $link = $_get['link'];     $link = str_replace(   array('%--', '--%'),    array('%', '%'),    $link ); echo $link; ?> 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -