-
Notifications
You must be signed in to change notification settings - Fork 0
/
pages.php
68 lines (54 loc) · 1.91 KB
/
pages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
session_start();
if(!isset($_SESSION["userName"]))
{
header("location:index.php");
};
$userName = $_SESSION['userName'];
$connection = mysqli_connect("localhost","root","") or die("Not connected to server");
define("userId","");
$currentPlace = $_GET['id'];
mysqli_select_db($connection,'travellog') or die(mysql_error);
$sqlUsers = "SELECT id FROM user WHERE userName = '$userName'";
$resultIds = mysqli_query($connection,$sqlUsers);
if(mysqli_num_rows($resultIds) >0)
{
while($rows = mysqli_fetch_assoc($resultIds))
{
$userId = $rows['id'];
}
}
$plaQuery = "SELECT * FROM places WHERE id_place = '$currentPlace' LIMIT 1";
$places = mysqli_query($connection,$plaQuery);
mysqli_select_db($connection,'travellog') or die(mysql_error);
$diaQuery = "SELECT * FROM diaries WHERE id_user = '$userId'";
$diaries = mysqli_query($connection,$diaQuery);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link href="css/home-style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#2e0049">
<?php while($place = mysqli_fetch_assoc($places)):?>
<div id="container-page" class="paper-page">
<div id="header-page">
<h1>#<?php echo $place['place'];?></h1>
<img src="<?php echo $place['location'];?>" width="600px" height="200px" align="center">
</div>
<div id="para-page">
<p> <?php echo $place['placeInfo'];?></p>
</div>
<div id="end-page">
<table align="center">
<td><img src="images/loveus.png" width="50px" height="50px"></td>
<td>***By- <?php echo $userName;?>***</td>
</table>
</div>
</div>
<?php endwhile;?>
</body>
</html>