Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.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中获取结果的可能解决方法是什么_Php_Mysql - Fatal编程技术网

在php中获取结果的可能解决方法是什么

在php中获取结果的可能解决方法是什么,php,mysql,Php,Mysql,我一直致力于在wordpress中将用户数据库显示为一个表。使用get_results()我也可以获得所需的输出。但是,通过传递参数是否有任何解决方法呢。以下是我的作品: <?php get_header(); ?> <?php global $wpdb; $table_name = $wpdb->prefix .'users'; $row = $wpdb->get_results("select*from $table_name"); echo "<h

我一直致力于在wordpress中将用户数据库显示为一个表。使用get_results()我也可以获得所需的输出。但是,通过传递参数是否有任何解决方法呢。以下是我的作品:

<?php
get_header(); ?>

<?php

global $wpdb;
$table_name = $wpdb->prefix .'users';
$row = $wpdb->get_results("select*from $table_name");

echo "<h2><center><u>List Of Members</u></center></h2>";
echo "<table class='table'>";
echo "<thead> 
      <tr>


      <th><center>Member Name</center></th>
      <th><center>Age</center></th>
      <th><center>Class</center></th>
      <th><center>Address</center></th>
      </tr>
      <thead>";

foreach ($row as $row) 

    {

    $usid = $row->ID;
    $username = $row->user_login;

    echo "<tr><td>".$username."</td>";
    $age=get_user_meta( $usid, 'age', true);
    echo "<td>".$age."</td>";
    $class=get_user_meta($usid, 'class', true);
    echo "<td>".$class."</td>";
    $address=get_user_meta($usid, 'address', true);
    echo "<td>".$address."</td>";
    }   
?>


有。使用get_用户本文将帮助您

get_用户需要在没有$wpdb的情况下运行;