query($sql); if ($result->num_rows > 0){ $row = $result->fetch_object(); $_SESSION["islogin"] = true; $_SESSION["nev"] = $row->nev; $_SESSION["id"] = $row->uid; $_SESSION["email"] = $row->email; } } if ($_SESSION["islogin"]){ $_SESSION["email"] = "valamiemail"; } else { $_SESSION["email"] = ""; } if(isset($_POST["uzenet"])){ //echo "Az üzeneted: ".$_POST["uzenet"]; //$nev = $_POST["nev"]; $id = $_SESSION["id"]; //$email = $_POST["email"]; $uzenet = $_POST["uzenet"]; //$ido = date() $sql = "INSERT INTO messages (uid, msg, status) VALUES (?,?,1)"; $param = $conn->prepare($sql); $param->bind_param("is",$id, $uzenet); if ($param->execute()){ echo "Sikeres üzenetmentés"; } else { echo "Sikertelen üzenetmentés: ".$param->error; } $param->close(); } $vendegkonyv = ""; $sql = "SELECT * from messages INNER JOIN felh ON felh.uid = messages.uid ORDER BY crdate DESC"; $result = $conn->query($sql); if ($result->num_rows > 0){ $row = $result->fetch_object(); $vendegkonyv = "
". $row->msg ."
"; $vendegkonyv .= "". $row->crdate ."
"; } else { echo "Nincs bejegyzés a vendégkönyvben."; }