모든 세션마다 데이터를 유지하려고합니다. 코드와 스크린 샷을 볼 수 있습니다.PHP로 페이지에서 다른 세션의 데이터를 유지하는 방법
<?php
require('connect.php');
session_start();
if(isset($_SESSION['email'])) {
echo "Your session is running " . $_SESSION['email'];
echo "</br></br>";
}
$a=$_SESSION['email'];
$sql = "SELECT title, content FROM post";
$result = mysqli_query($connection, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "Posted by: $a </br> Title: " . $row["title"]. " </br> Content: " . $row["content"]. "</br></br>";
}
} else {
echo "0 results";
}
?>
<html>
<head></head>
<body>
<form action="post.php" method="post">
You can add new content or <a href='logout.php'>Logout</a></br></br>
Your Email:</br>
<input type="text" required autocomplete="off" name="email"/></br></br>
Title:</br>
<input type="text" required autocomplete="off" name="title"/></br></br>
Content:</br>
<textarea rows="4" cols="50" required autocomplete="off" name="content">
</textarea></br></br>
<input type="submit" value="Send">
</form>
</body></html>
하지만 난 @ A를 로그인하고있을 때. 그것은 그렇게 보입니다. Second
나는 각 세션에 대한 모든 내용을 유지하려면. [email protected]으로 입력하고이 세션에서 로그 아웃 한 후 나는 "게시자 : [email protected]"(그 내용을 쓰는 이메일을 통해)을보고 싶다. 다른 세션들도있다. 매번 내 현재 세션 메일이 표시되지 않습니다. 내가 어떻게 할 수 있니? 에서
Omg, 나는 완전히 잘못된 것을 묻습니다. 죄송합니다. 어떻게 데이터베이스에 세션 이메일을 추가 할 수 있습니까? 캡쳐 화면에 양식 이메일을 보내시겠습니까? 그러면 이메일을 어떻게 볼 수 있습니까? – Unicepter