2
我一直在努力将用户数据库显示为wordpress中的表格。使用get_results()我也得到我想要的输出。但是,通过传递参数是否有任何解决方法。这是我的工作:什么是可能的解决方法get_results在PHP
<?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>";
}
?>
<?php global $ wpdb; $ table_name = $ wpdb->前缀.'users'; 的$ args =阵列( 'ID'=> $ USID, \t \t \t 'USER_LOGIN'=> $用户名, \t \t \t 'meta_key'=> '地址', \t \t \t 'meta_value'=> $地址); $ row = $ wpdb-> get_users($ args); 的foreach($行作为$行) 现在的错误是发生未定义的方法get_users() – Jackson
get_users需要不WPDB $运行; –