【问题标题】:Cross tabulation using PHP使用 PHP 的交叉制表
【发布时间】:2016-03-15 02:31:22
【问题描述】:

我该如何定义

$allRoles = array('musician', 'leader', 'singer'); // !important

上面动态in this answer?我的意思是说$allRoles 实体应该来自 MySQL 表,而不是在这里定义每个实体。

【问题讨论】:

标签: php mysql


【解决方案1】:
$query =  "select role from user_role";

$result = mysqli_query($con,$query);

$allroles = array();
    while($row = mysqli_fetch_array($result))
    {
        $allroles[] = $row['role'];
    }

print_r($allroles);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    • 2012-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多