加入查询中的DATE回显错误字符

时间:2018-04-11 14:34:41

标签: php mysql

我有一个大型查询从几个表中提取数据。我的投递日期与错误的字符相呼应。这是我的代码以及它返回的图像。此代码下面是来自单个表的查询,日期看起来很好。关于如何解决这个问题的任何想法。

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$query = $connect->prepare("(SELECT 
jobs.jobID,
jobs.jobName,
jobs.pdfMolding,
jobs.statusOrder,
jobs.deliveryDate,

jobstatus.status,
jobstatus.statusOrder,

rooms.roomID, 
rooms.roomName, 
rooms.sprayDungeonS,
rooms.sprayDungeonF,
rooms.sprayDungeonNeeded,
rooms.woodType,
rooms.finishType,
rooms.finishColor,
rooms.isRush,
rooms.description,
jobnotes.note,

rushready.sprayDungeon,

startfinishcheck.sprayDungeonSE,
startfinishcheck.sprayDungeonFE
FROM jobs 
LEFT JOIN rooms ON jobs.jobID = rooms.jobID 
LEFT JOIN jobnotes ON jobnotes.jobID = jobs.jobID
LEFT JOIN jobstatus ON jobstatus.statusOrder = jobs.statusOrder
LEFT JOIN rushready ON rushready.roomID = rooms.roomID
LEFT JOIN startfinishcheck ON startfinishcheck.roomID = rooms.roomID
WHERE rooms.sprayDungeonNeeded = 1 AND rooms.isRush = 1 AND sprayDungeonF = 0 AND rushready.sprayDungeon = 1
OR rooms.isRush = 1 AND sprayDungeonF IS NULL AND rushready.sprayDungeon = 1 AND rooms.sprayDungeonNeeded = 1
GROUP BY rooms.roomID
ORDER BY deliveryDate LIMIT 50)

UNION ALL

(SELECT 
jobs.jobID,
jobs.jobName,
jobs.pdfMolding,
jobs.statusOrder,
jobs.deliveryDate,

jobstatus.status,
jobstatus.statusOrder,

rooms.roomID, 
rooms.roomName, 
rooms.sprayDungeonS,
rooms.sprayDungeonF,
rooms.sprayDungeonNeeded,
rooms.woodType,
rooms.finishType,
rooms.finishColor,
rooms.isRush,
rooms.description,
jobnotes.note,
rushready.sprayDungeon,
startfinishcheck.sprayDungeonSE,
startfinishcheck.sprayDungeonFE
FROM jobs 
LEFT JOIN rooms ON jobs.jobID = rooms.jobID 
LEFT JOIN jobnotes ON jobnotes.jobID = jobs.jobID
LEFT JOIN jobstatus ON jobstatus.statusOrder = jobs.statusOrder
LEFT JOIN rushready ON rushready.roomID = rooms.roomID
LEFT JOIN startfinishcheck ON startfinishcheck.roomID = rooms.roomID
WHERE ((rooms.sprayDungeonNeeded = 1 AND jobstatus.statusOrder >= 0 AND rooms.sprayDungeonF IS NULL)
OR (rooms.sprayDungeonNeeded = 1 AND jobstatus.statusOrder >= 0 AND rooms.sprayDungeonF = 0))
AND ((rooms.isRush = 0 AND rooms.sprayDungeonF = 0) OR (rooms.isRush = 0 AND rooms.sprayDungeonF IS NULL))
GROUP BY jobs.jobName, rooms.woodType, rooms.finishColor 
ORDER BY jobs.statusOrder = 7 DESC, deliveryDate, jobName, finishType LIMIT 50)");

if(!$query) {
    echo("Query Failed Because " . mysqli_error($connect));
};

$query->execute();
$result = $query->get_result();
while($row = mysqli_fetch_assoc($result)) {
    $jobID = $row['jobID'];
    $test = $row['deliveryDate'];
    echo $jobID . "-" . $test . "<br>";
}

enter image description here

这是一个简单的查询,其中一切都正确返回

$query = $connect->prepare("SELECT jobID, deliveryDate FROM jobs WHERE statusOrder > -1");

enter image description here

0 个答案:

没有答案