更新时间:2023-02-06 20:20:42
要知道为什么会出现空白屏幕,您必须打开error_reporting,请在php代码开头添加以下内容:
to know why you get a blank screen you have to turn on error_reporting, add the following at the start of your php code before anything else:
error_reporting(-1);
还添加一些代码来显示MySQL中可能发生的错误:
Also add some code to show errors that might happen in MySQL:
if(isset($UserID)) {
$users = $con->prepare("
SELECT DISTINCT
d.FirstName
,d.LastName
,d.Picture
FROM Details
WHERE d.UserId = ?
");
if (!$users) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
$binding = $users->bind_param('i', $GetUserId);
if (!$binding) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
if($users->execute() == false) {
echo 'Error: ' . $con->error;
}
$binding_results = $users->bind_result(
$FirstName,
$LastName,
$Picture
);
if (!$binding_results) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
$users2 = $con->prepare("
SELECT DISTINCT
Foo
, Bar
, FooBar
FROM Bizz
WHERE UserId = ?
");
if (!$users2) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
$binding2 = $users2->bind_param('i', $GetUserId);
if (!$binding2) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
if($users2->execute() == false) {
echo 'Error: ' . $con->error;
}
$binding_results2 = $users2->bind_result(
$Foo,
$Bar,
$FooBar
);
if (!$binding_results2) {
echo 'MySQL Connect Error in Query: (' . $mysqli->errno . ') ';
}
我可以在您的第一个查询中看到一个错误.您正在使用d.FirstName,其中表名是Details
I can see one mistake in your first query. you are using d.FirstName where as the table name is Details