我正在尝试从我的查询中输出一个连接值,但遇到了一些问题。
这是我的查询:
$result = mysql_query(
"SELECT c.company, n.nid, n.createdOn, CONCAT_WS(' ',c2.fname,c2.lname), CONCAT_WS(' ',c3.fname,c3.lname), n.urgent, n.description
FROM notes n
INNER JOIN Positions p ON FIND_IN_SET(p.id, n.forDepts) > 0
LEFT JOIN companies c ON c.userid = n.clientId
LEFT JOIN companies c2 ON c2.userid = n.createdBy
LEFT JOIN companies c3 ON c3.userid = n.claimedBy
GROUP BY n.nid
LIMIT 0,100"
);
我的数组打印如下:
Array ( [0] => Honda of Kirkland [company] => Honda of Kirkland [1] => 1 [nid] => 1 [2] => 2009-09-28 21:33:15 [createdOn] => 2009-09-28 21:33:15 [3] => [CONCAT_WS(' ',c2.fname,c2.lname)] => [4] => [CONCAT_WS(' ',c3.fname,c3.lname)] => [5] => 0 [urgent] => 0 [6] => Milestones [description] => Milestones )
我正在尝试这样,但它不起作用:
while ($row = mysql_fetch_array($result)) {
$created_by = $row[3];
}