-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
96 lines (89 loc) · 4.63 KB
/
index.php
File metadata and controls
96 lines (89 loc) · 4.63 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Fontello Mysql example</title>
<link rel="stylesheet" href="icon-style.css" type="text/css">
<link rel="stylesheet" href="css/animation.css" type="text/css">
<!--[if IE 7]><link rel="stylesheet" href="css/fontello-ie7.css"><![endif]-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>fontello mysql example</h1>
<ol>
<li>Connect with your DB.</li>
<li>Change the following <strong>CODE</strong> with your credentials.</li>
</ol>
<div class="alert-dark p-3">
<code>$mysqli = new mysqli("your_host_name_here", "your_db_user_name_here", "your_db_password_here", "your_db_name_here");
<br>/* check connection */<br>
if ($mysqli->connect_errno) {<br>
printf("Connect failed: %s\n", $mysqli->connect_error);<br>
exit();<br>
}
<br>
$query = "SELECT * FROM `tb_icons`";<br>
$result = $mysqli->query($query);<br>
while($row = $result->fetch_array()){<br>
<kbd>Your loop code here....</kbd><br>
}<br>
</code>
</div>
<hr>
<h3>With DB Example</h3>
<hr>
<div class="row">
<?php
$mysqli = new mysqli("localhost", "root", "", "test");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$query = "SELECT * FROM `tb_icons`";
$result = $mysqli->query($query);
/* numeric array */
while($row = $result->fetch_array()){
?>
<div class="col-4">
<i class="icon <?php echo $row['icon']; ?>"><?php echo $row['print_code']; ?></i> <span><?php echo $row['icon']; ?></span> <code><?php echo $row['code']; ?></code>
</div>
<?php } ?>
</div>
<hr>
<h3>Simple Example with PHP</h3>
<hr>
<div class="row">
<?php
$res = array(
''=>'icon-search-7',
''=>'icon-user-add',
''=>'icon-picture-outline',
''=>'icon-ok',
''=>'icon-eq',
''=>'icon-tags',
''=>'icon-upload-outline',
);
foreach($res as $key=>$val){ ?>
<div class="col-3"><i class="icon <?php echo $val; ?>"><?php echo $key; ?></i> <span><?php echo $val; ?></span></div>
<?php } ?>
</div>
<hr>
<h3>Simple Example with CSS</h3>
<hr>
<div class="row">
<div class="col-3"><i class="icon icon-search-7"></i> <span>icon-search-7</span></div>
<div class="col-3"><i class="icon icon-user-add"></i> <span>icon-user-add</span></div>
<div class="col-3"><i class="icon icon-picture-outline"></i> <span>icon-picture-outline</span></div>
<div class="col-3"><i class="icon icon-ok"></i> <span>icon-ok</span></div>
<div class="col-3"><i class="icon icon-eq"></i> <span>icon-eq</span></div>
<div class="col-3"><i class="icon icon-tags"></i> <span>icon-tags</span></div>
<div class="col-3"><i class="icon icon-upload-outline"></i> <span>icon-upload-outline</span></div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>