-
Notifications
You must be signed in to change notification settings - Fork 0
/
datavillas.php
70 lines (52 loc) · 2.31 KB
/
datavillas.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
69
70
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php $browser = $_SERVER['HTTP_USER_AGENT']; ?>
<?php if (strstr($browser, "MSIE")) { ?>
<link rel="stylesheet" href="stylesheets/articleIEstyle.css" type="text/css" media="screen" />
<?php }else{ ?>
<link rel="stylesheet" href="stylesheets/articlestyle.css" type="text/css" media="screen" />
<?php } ?>
<?php
include("include/connection.php");
$result1 = $mysqli->query("SELECT title, content FROM villas")or die($mysqli->error);
$numRows = $result1->num_rows;
if($numRows<10 && $numRows!=0)
{
$a = $numRows-5;
$statement = $mysqli->prepare("SELECT title, content FROM villas ORDER by id ASC LIMIT ? ");
$statement->bind_param('i', $a);
$statement->execute() or die($mysqli->error);
$result = $statement->get_result();
while( $row = $result->fetch_array())
{
echo "<div id='title'> <span class='t'>". $row['title']."</span></div><br/><br/>";
echo "<div id='content'>";
echo substr($row['content'], 0, 450);
echo "<a href='details.php?id=".$row['0']."'><div class='more'>..الـمـزيـد</div></a><br/><br/><br/>";
echo "</div>";
}
}
elseif($numRows>10)
{
$start = $numRows-5;
for($i=0;$i<=4;$i++)
{
$statement = $mysqli->prepare("SELECT * FROM villas WHERE id=? ORDER by id DESC ");
$statement->bind_param('i', $start);
$statement->execute() or die($mysqli->error);
$result = $statement->get_result();
$row = $result->fetch_array();
echo "<div id='title'> <span class='t'>". $row['title']."</span></div><br/><br/>";
echo "<div id='content'>";
echo substr($row['content'], 0, 450);
echo "<a href='details.php?id=".$row['0']."'><div class='more'>..الـمـزيـد</div></a><br/><br/><br/>";
echo "</div>";
$start-=1;
}
}
elseif($numRows==0)
{
echo "لايوجد عروض الآن";
}
?>