The front desk input: & lt; Input the name="code" type='text' placeholder="please enter the number" & gt;
Read data: $code=trim ($_GET [] "code");
Query data: $SQL="select * from tgs_code where code like '% % $code limit 1";
CodePudding user response:
Just found and tested the # & amp; | the three symbol will appear this problem, such as other! % @ $... * () & lt;>/? Among works, if it is + will empty one, don't know is what circumstance,CodePudding user response:
When you construct the query need to special characters, such as # & amp; | \ such as character processing, inside you read characters find these special characters, and then in front of these special characters \ can increase escape symbolCodePudding user response:
Or change to another kind of efficient method:Read data: $code=trim ($_GET [] "code");
Query data: $SQL="select * from tgs_code where locate (' $code, code) & gt; 0 limit 1 ";
CodePudding user response:
# # are comments symbols in mysql, after things are as the content of the comments, will not do resolution, # and | should also have the corresponding effect, but the is not very clear, have know a great god can science,CodePudding user response:
'& amp; 'and' | 'is an operator, feeling should be able to have an impact on the query, should not be truncation,CodePudding user response:
Use quotation marks should be no problem,
CodePudding user response:
$SQL="select * from tgs_code where code like '% {$code} %' limit 1";Try this?
CodePudding user response: