我有一个名为global_settings
2 列的表(field, value)
我需要一种使每一行成为变量的方法
例如:
是field = title
,value = hello
我需要:
$title = 'hello';
我试过这样做:
$global_sql="SELECT * from global_settings ";
$global_rs=mysql_query($global_sql,$conn) or die(mysql_error());
while($global_result=mysql_fetch_array($global_rs))
{
$global_sql2="SELECT * from global_settings where field = '".$global_result["field"]."' ";
$global_rs2=mysql_query($global_sql2,$conn) or die(mysql_error());
$global_result2=mysql_fetch_array($global_rs2);
$global_result2["field"] = $global_result2["value"];
}
但这没有用 - 有什么想法吗?