我正在做一个私人消息系统。我的表单正确地发布到我的表中,但返回查询拉出了一些奇怪的东西。我对加入表格有点陌生......
带有 sql 查询的 PHP 代码:
function fetch_messages() {
$sql = "SELECT
`conversations`.`con_id`,
`conversations`.`con_subject`,
MAX(`conversations_messages`.`message_date`) AS `con_last_reply`
FROM `conversations`
LEFT JOIN `conversations_messages` ON `conversations`.`con_id` = `conversations_messages`.`con_id`
INNER JOIN `conversations_members` ON `conversations`.`con_id` = `conversations_members`.`con_id`
WHERE `conversations_members`.`user_id` = 31
AND `conversations_members`.`con_deleted` = 0
GROUP BY `conversations`.`con_id`
ORDER BY `con_last_reply` DESC";
$result = mysql_query($sql);
$conversations = array();
while (($row = mysql_fetch_assoc($result)) !== false) {
$conversations[] = array(
`id` => $row['con_id'],
`subject` => $row['con_subject'],
`con_last_reply` => $row['last_reply']
);
}
return $conversations;
}
返回数组:
Array ( [0] => Array (
[uid=8927072(user007) gid=100450(inetuser) groups=100450(inetuser) ] => 1
[] => ) )
(这几乎就像它在返回我的 ftp 信息?user007 是我打开的 ftp 连接名称,但这不是表格中的内容!!)