我有一个常规的 wp_users 表和 sh_users 表。
wp_users 表是标准的:ID、user_login、user_pass、user_nicename、user_email、user_url、user_registered、user_activation_key、user_status、display_name
sh_users 表有:id(自动递增)、user_id(与 wp_users ID 匹配)、user_photo(Varchar 255)、user_gender(varchar 255)
现在当我这样查询时
$results = $wpdb->get_results( "
SELECT user_login, user_email, user_photo
FROM wp_users, sh_users
WHERE wp_users.ID = sh_users.user_id
");
...这是该查询的 var 转储:
string '
SELECT user_login, user_email, user_photo
FROM wp_users, sh_users
WHERE wp_users.ID = sh_users.user_id
' (length=109)
它什么也不返回... +没有产生任何错误...所以我只是问那里有什么问题???
- - - 更新 - - - -
这是 wp 用户的转储:
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
(1, 'pete', 'xxxxxxx', 'pete', 'HIDDEN@gmail.com', '', '2013-07-02 16:42:04', '', 0, 'pete'),
(15, 'test', 'xxxxxx', 'test', 'HIDDEN@gmail.com', '', '2013-07-15 11:17:01', '', 0, 'test'),
(16, 'test1', 'xxxxx', 'test1', 'b.HIDDEN@gmail.com', '', '2013-07-15 20:05:32', '', 0, 'test1'),
(17, 'test5', 'xxxxxx', 'test5', 'HIDDEN.pe@gmail.com', '', '2013-07-16 09:48:57', '', 0, 'test5'),
(23, 'ban', 'xxxxx', 'ban', 'HIDDEN4@gmail.com', '', '2013-07-24 23:24:31', '', 0, 'bane'),
(24, 'ban2', 'xxxx', 'ban2', 'HIDDEN.HIDDEN@gmail.com', '', '2013-07-31 17:41:46', '', 0, 'ban2');
sh_users 的 Mysql 转储:
---- Dumping data for table `sh_users`--
INSERT INTO `sh_users` (`id`, `user_id`, `user_registered`, `user_active`, `user_location`, `user_gender`, `user_photo`, `user_meet`, `user_text`, `user_subscribed`) VALUES
(5, 15, '1373894222', 'Y', '', '', '17-profile.jpg', '', '', ''),
(6, 16, '1373925933', 'Y', '', '', '17-profile.jpg', '', '', ''),
(7, 17, '1373975337', 'Y', 'Midtjylland', 'Hende', '17-profile.jpg', 'Nej', '', 'Y'),
(13, 23, '1375298672', 'N', 'Midtjylland', 'Hende', '23-profile.jpg', 'Nej', '', 'Y'),
(14, 24, '1375299707', 'N', '', '', 'no-image.png', '', '', '');