为什么用变量时,不对:
$name="bill";
$sql="select * from news where type=$name order by fbdate";
而用常量就对了:
$sql="select * from news where type='bill' order by fbdate";
请问如何在选择语句中在where查询的时候可以用变量?
...全文
32回复打赏收藏
为什么用变量时,不对:
为什么用变量时,不对: $name="bill"; $sql="select * from news where type=$name order by fbdate"; 而用常量就对了: $sql="select * from news where type='bill' order by fbdate"; 请问如何在选择语句中在where查询的时候可以用变量?