1

这是我的 ADOdb 代码:

$sql  = "SELECT m.*, s.photo, s.gender
         FROM mail AS m, signup AS s
         WHERE m.receiver = '" .mysql_real_escape_string($username). "'
         AND m.sender = s.username AND inbox = '1' AND status = '1'
         ORDER BY send_date DESC LIMIT " .$limit;
// my date is in the format 2012-08-02 02:20:05

$rs1  =  $conn->execute($sql);
$time =  $rs1->GetAssoc('send_date'); //GetArray Or GetRows
echo $time;

echo 显示了一个数组,但我需要的是显示 row send_date

(而不是->GetAssoc,我也尝试过->GetArray->GetRows。)

如何显示该行 send_date

4

1 回答 1

1

您没有正确使用 adodb。它具有用于转义参数的内置机制,以及用于有限结果的单独方法:

$sql  = "SELECT m.*, s.photo, s.gender
         FROM mail AS m, signup AS s
         WHERE m.receiver = ?
         AND m.sender = s.username 
         AND inbox = '1' 
         AND status = '1'
         ORDER BY send_date DESC";
$rs1  =  $conn->selectLimit($sql, $limit, -1, array($username));

// You will recive recordset with maximum of $limit rows, so you have to iterate through it:
while($row = $rs1->FetchRow()){
   echo $row['send_date'] . "\n";
}
于 2012-08-04T21:33:59.843 回答