1
私は行を削除してセッションにメッセージを保存する方法を確認する方法を考えているので、rowCount()がそれは何も返しません。私がdie()を使うと、空白の画面しか表示されません。ここに私の機能があります。die()から戻り値を取得しない
public function destroy($id)
{
$stmt = $this->connection->prepare('
DELETE FROM users WHERE id = :id
');
$stmt->bindParam(':id', $id);
$stmt->execute();
die($count = $stmt->rowCount()); // I get no return value or anythhing on this line
// It just gives me a blank screen whether I enter a
// valid id or not
$msg = new \Plasticbrain\FlashMessages\FlashMessages();
if (!session_id()) @session_start();
if($count){
$msg->success('User successfully deleted', 'index.php');
} else {
$msg->error('User ID not existing', 'index.php');
}
header("location:index.php");
}
@ YourCommonSenseの答えをフォローアップするには、カウントをエコーアウトしてから、 'die()'または単純に 'exit;' – FrankerZ