$data = M("data");
$data ->where( 'dataid = $d')->select();
p($data);
p($d);
小弟在前台获取了$d,通过p($d);能输出获取的值,
但$data输出不了,显示 如下:最后的123就是$d
Model ob
(
[_extModel:Model:private] =>
[db:protected] => DbMysql ob
(
[dbType:protected] => MYSQL
[autoFree:protected] =>
[model:protected] => _think_
[pconnect:protected] =>
[queryStr:protected] => SELECT * FROM `hd_data` WHERE ( dataid = $d )
[modelSql:protected] => Array
(
[data] => SELECT * FROM `hd_data` WHERE ( dataid = $d )
)
[lastInsID:protected] =>
[numRows:protected] => 11
[numCols:protected] => 0
[transTimes:protected] => 0
[error:protected] => 1054:Unknown column '$d' in 'where clause'
[ SQL语句 ] : SELECT * FROM `hd_data` WHERE ( dataid = $d )
[li
(
[0] => Resource id #30
)
[_li
[queryID:protected] =>
[connected:protected] => 1
[comparison:protected] => Array
(
[eq] => =
[neq] => <>
[gt] => >
[egt] => >=
[lt] => <
[elt] => <=
[notlike] => NOT LIKE
[like] => LIKE
[in] => IN
[notin] => NOT IN
)
[selectSql:protected] => SELECT%DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%%COMMENT%
[bind:protected] => Array
(
)
)
[pk:protected] => id
[tablePrefix:protected] => hd_
[name:protected] => data
[dbName:protected] =>
[connection:protected] =>
[tableName:protected] =>
[trueTableName:protected] => hd_data
[error:protected] =>
[fields:protected] => Array
(
[0] => id
[1] => dataname
[2] => pname
[3] => pid
[4] => fname
[5] => fid
[6] => sname
[7] => sid
[8] => bname
[9] => bid
[10] => dataid
[_autoinc] => 1
[_pk] => id
[_type] => Array
(
[id] => int(20)
[dataname] => varchar(50)
[pname] => varchar(50)
[pid] => int(20)
[fname] => varchar(50)
[fid] => int(20)
[sname] => varchar(50)
[sid] => int(20)
[bname] => varchar(50)
[bid] => int(20)
[dataid] => int(20)
)
)
[data:protected] => Array
(
)
[options:protected] => Array
(
)
[_validate:protected] => Array
(
)
[_auto:protected] => Array
(
)
[_map:protected] => Array
(
)
[_scope:protected] => Array
(
)
[autoCheckFields:protected] => 1
[patchValidate:protected] =>
[methods:protected] => Array
(
[0] => table
[1] => order
[2] => alias
[3] => having
[4] => group
[5] => lock
[6] => distinct
[7] => auto
[8] => filter
[9] => validate
[10] => result
[11] => bind
[12] => token
)
)
123
最佳答案