简体   繁体   English

PHP MYSQL基于变量的显示表列

[英]PHP MYSQL Display table column based on variable

Using the following variables 使用以下变量

I have the Following table named everyones_friends; 我有一个名为所有人的下表: id, john, jack, bill, dave 1, jack, john, dave, bill 2, bill, dave, john, jack 3 dave, bill, jack, john id,约翰,杰克,条例草案,戴夫1,杰克,约翰,大卫,条例草案2,条例草案,戴夫,约翰,杰克3戴夫,条例草案,杰克,约翰

doing the following query; 进行以下查询;

$sql = "SELECT * FROM everyones_friends";
$mydata = mysql_query($sql);
while($record = mysql_fetch_array($mydata));
$display_column['$variable'];

My question is how do I display the "bill" column using a previously user selected variable since I know the $display_column['$variable']; 我的问题是,由于我知道$ display_column ['$ variable'],因此如何使用以前用户选择的变量显示“帐单”列; won't work. 将无法正常工作。 Based on their choice one of the columns above goes into a dropdown. 根据他们的选择,上面的列之一进入下拉列表。

update this line to be : 将此行更新为:

$display_column[$variable];

single quota in php doesn't parse php variables. php中的单个配额不会解析php变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM