mysql - PHP Like Function with combination code -


<form method="post" action="post.php"> <input type="text" name="code"/> </form> 

<?php $code = $_post['code']; include ("db.php"); $query = mysql_query("select * t_code code '$code'"); if(mysql_num_rows($query)) { echo "got data"; } else echo "no data"; } 

in table t_code

code_id | code 1       | gg125-0015 2       | ba512-1152 

now want when user have combination code : gg1250015--0021255 or ba5121152--52211554, echo got data, because see code include on database.

so how can set sql using ? advice ?

$code=substr($mainsub,0,5)."-".substr($mainsub,5,4); $query = mysql_query("select * t_code code='$code'"); 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -