嘿伙计们,所以我在使用以下内容时遇到了一些麻烦:
for ($i = 0; $i < count($noncompUsername); $i++)
{
$tsql ="SELECT firstname,lastname,email,phone,statuschangedate FROM csvdata WHERE username = :username ORDER BY statuschangedate";
$tgetmeminfo=$DBH->prepare($tsql);
$tgetmeminfo->execute(array(':username' => $noncompUsername[$i]));
while ($trow = $tgetmeminfo->fetch(PDO::FETCH_ASSOC)){
$csvFirst = $trow['firstname'];
$csvLast = $trow['lastname'];
$csvEmail = $trow['email'];
$csvPhone = $trow['phone'];
$csvDate = $trow['statuschangedate'];
$timediff = strtotime($date) - strtotime($csvDate);
$timediff = floor($timediff/86400);
$sql ="SELECT MailingAdrs FROM insuranceverificationdisclaimer WHERE TraineeUsername = :tusername";
$getmeminfo=$DBH->prepare($sql);
$getmeminfo->execute(array(':tusername' => $noncompUsername[$i]));
while ($row = $getmeminfo->fetch(PDO::FETCH_ASSOC)){
$csvAddrs = $row['MailingAdrs'];
$change = 1;
}
if($change != 1)
{
$csvAddrs = "No address";
}
$change = 0;
echo "$timediff, $csvFirst $csvLast, $csvEmail, $csvPhone, $csvAddrs";
}
echo "
<br>
";
}
现在这可行,但我要指出的部分是$tsql ="SELECT firstname,lastname,email,phone,statuschangedate FROM csvdata WHERE username = :username ORDER BY statuschangedate";
- 现在当我这样做并将 statuschangedate 的整数获取到当前日期并将其打印为整数时,它没有根据日期正确排序。
所以我需要在最旧的日期之前订购它,如下所示......
谢谢!
大卫