我正在尝试通过使用像这样的 php 静态变量来获取数组值
$a = $_GET['type'];
if($a==1)
{
$variable = 'cost';
$tablename = 'logistics_bluedart';
}
else if($a==2)
{
$variable = 'shp_cost';
$tablename = 'logistics_prof';
}
else if($a==3)
{
$variable ='shipping_cost';
$tablename = 'logistics_firstflight';
}
$myQuery = mysql_query("select $variable from $tablename");
while($resultData = mysql_fetch_array($myQuery)){
echo $resultData[$variable];
}
但我没有得到任何输出?