【发布时间】:2012-04-24 17:10:38
【问题描述】:
我在发布之前进行了搜索,但没有找到我的问题的答案。
我在数据库中有一个存储查询的表,例如(将 php 变量存储在数据库中):
select * from accounts where type = 'client'
select * from accounts where user_id = $userid
select * from accounts where name = '$name'
我假设当我从数据库中提取特定查询时,PHP 会识别该变量并替换它,但它会将其视为常规文本。
有没有办法让 PHP 将 $__ 替换为存在的实际变量?我想也许是 eval() 函数??
【问题讨论】:
-
您从哪里执行脚本?为了使 php 变量起作用,您应该在 php 脚本中执行 sql 语句
标签: php mysql variables storage