-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-dtrips.php
45 lines (41 loc) · 1.7 KB
/
load-dtrips.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
<?php
//load deluxe trips
//set limit higher than last
$tripsNewCount = $_POST['tripsNewCount'];
//check connection
$conn = false;
$file='./connection.php';
if(file_exists($file)) {include($file);}
//set variables and check for connection
$content = '';
if (!$conn) {
//If not connected
$content.= "Can not conect with database !!!";
}
else
{
//If connection succes execute sql
$res = $conn->query("SELECT * FROM tripsmodel Where type = 'Deluxe' LIMIT $tripsNewCount");
while($row=$res->fetch()) {
//Get all the records and assign them to variables
$id= htmlentities($row['id']);
$name = htmlentities($row['name']);
$type = htmlentities($row['type']);
$time = htmlentities($row['time']);
$bprice = htmlentities($row['bprice']);
//Put those variables into html code set in variable
$content.= '<div class="trip-box">
<img src="img/trip-card/'.$name.'.jpg">
<div class="trip-info">
<h3> '. $name. '</h3>
<h4> '. $type. ' </h4>
<h4> '. $time. ' days</h4>
<h4> '. $bprice. ' € </h4>
<a href="trip.php?tmid='.$id.'">More</a>
</div>
</div>';
}
}
//Show where statement is true
echo $content;
?>