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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -