-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.php
More file actions
58 lines (52 loc) · 1.43 KB
/
Copy pathsample.php
File metadata and controls
58 lines (52 loc) · 1.43 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>database connections</title>
</head>
<body>
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$servername = "localhost";
$username = "root";
$password = "";
$db_name = "book_store";
print_r(date("d/m/Y"));
echo "<br>";
// print_r(strtotime($date2));
echo "<br>";
$date1 = 2015-01-25;
$date2 = 2015-02-28;
$number_days =date_diff(strtotime($date2),strtotime($date1));
echo $number_days;
echo "<br>";
$connector = mysql_connect($servername,$username,$password)
or die("Unable to connect");
echo "Connections are made successfully::";
$selected = mysql_select_db("$db_name", $connector)
or die("Unable to connect");
//execute the SQL query and return records
$result = mysql_query("SELECT user_name FROM book_kart");
?>
<table border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php
while( $row = mysql_fetch_assoc( $result ) ){
echo
"<tr>
<td>
{$row['user_name']}
</td>
</tr>\n";
}
?>
</tbody>
</table>
<?php mysql_close($connector); ?>
</body>
</html>