你知道可能是什么问题吗?查询工作正常。我在PHPMyAdmin中尝试了它,它返回了我期望的所有内容,除了taskTime
,它不是空的。它给出了正确的数字:
$mysqli = new mysqli($SQLhost, $SQLusername, $SQLpassword, $SQLdatabase);
$stmt = $mysqli->prepare("SELECT Account.accountEmail, Account.accountUsername,Task.taskName,Task.taskDescription,Task.taskTime FROM Account INNER JOIN Task ON Task.accountId=Account.accountId WHERE taskId=?");
$stmt->bind_param('i', $taskId);
$stmt->execute();
$stmt->bind_result($accountEmail,$accountUsername,$taskName,$taskDesc,$taskTime);
echo("Account Email: " . $accountEmail . " | Account Username: " .$accountUsername . " | Task Name: " . $taskName . " | Task Desc: " . $taskDesc . " | Task Time: " . $time . " | Task Id: " . $taskId);
答案 0 :(得分:0)
工作代码:
$mysqli = new mysqli($SQLhost, $SQLusername, $SQLpassword, $SQLdatabase) or die("Error " . mysqli_error($mysqli));
$stmt = $mysqli->prepare("SELECT Account.accountEmail, Account.accountUsername,Task.taskName,Task.taskDescription,Task.taskTime FROM Account INNER JOIN Task ON Task.accountId=Account.accountId WHERE taskId=?");
$stmt->bind_param('i', $taskId);
$stmt->execute();
$stmt->bind_result($accountEmail,$accountUsername,$taskName,$taskDesc,$taskTime);
$stmt->fetch();