Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php echo变量存储在mysql字段中_Php_Mysql_Variables - Fatal编程技术网

php echo变量存储在mysql字段中

php echo变量存储在mysql字段中,php,mysql,variables,Php,Mysql,Variables,我试图找出如何回显存储在mysql数据库中的变量名。 例如: 在我存储的表的“变量”字段中: $target["year"] PHP代码: $target["year"]="2013"; while ($row = mysql_fetch_array($query)) { echo $row['variable']; // Output should be 2013 } 我在php.net上阅读了variables变量这篇文章,但找不到解决问题的方法然后将值存储在数据库中;

我试图找出如何回显存储在mysql数据库中的变量名。 例如:

在我存储的表的“变量”字段中:

$target["year"]
PHP代码:

$target["year"]="2013";
while ($row = mysql_fetch_array($query))    
{ 
    echo $row['variable']; // Output should be 2013
}

我在php.net上阅读了variables变量这篇文章,但找不到解决问题的方法

然后将值存储在数据库中;)在
variable
字段中,则有输出
2013
。如果直接查看数据库,是否在数据库的
variable
列中看到“2013”?如果没有,则需要查看如何将数据插入数据库。查看插入到DB的代码可能会对我们有所帮助……在数据库表中存储变量的名称(而不是存储值)这似乎是一种令人困惑的方法。目的是用数据库中存储的变量控制一点php代码。使用
eval
,您可能会得到想要的结果,但我强烈建议您重新考虑您的结构。数据库中存储的数据不应用作代码。