字段本身用变量来表示,
我试过用“$字段变量”
也试过'".$字段变量."'
还试过$字段变量
还有'$字段变量'均错,求正确方法,感谢。有网友这么写 "select fileds from table where $filed_name='$filed_value'" 也失败了
我试过用“$字段变量”
也试过'".$字段变量."'
还试过$字段变量
还有'$字段变量'均错,求正确方法,感谢。有网友这么写 "select fileds from table where $filed_name='$filed_value'" 也失败了
ASQL="select fileds from table where "+$filed_name+"='"+$filed_value+"'"
$值 = 123;
$sql = "select * from 表 where $字段='$值'";mysql_query($sql)
check the manual that corresponds to your MySQL server version for the right syntax to use near '='栏目1'' at line 1select * from ***_ecms_news where ='栏目1'
$sql = "select * from table where id='{$id}'";
mysql_query($sql);这个试试,不对就奇了怪了
mysql_query($sql);
mysql_query($sql);
成功啦,谢谢哥们了。又成功排除了一条错误答案。 呵呵 开个玩笑它提示 select c* from ***_ecms_news where ='栏目1'
$fieldname = "id";
$id = "1";
$sql = "select * from table where ".$fieldname."='{$id}'";
echo $sql;你确定你赋值了吗?这个你运行看 看
输出的应该是select * from table where id='1'
<?php
$ab=city;
include('../../shuchu.php');
?>
shuchu.php 代码如下
连接数据库$da=北京;
$num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news where ".$ab."='{$da}'");
$num=$empire->gettotal 这个是cms的自带函数,大意是统计信息条数。然后执行错误 代码就是我贴的那个。 我从新建立个php试一下楼上你的那个代码