-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
52 lines (43 loc) · 1.01 KB
/
example.php
File metadata and controls
52 lines (43 loc) · 1.01 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
<?php
/**
* Created by PhpStorm.
* User: adm_gcs
* Date: 10/19/2016
* Time: 4:54 PM
*/
####################################################
################ Preprocessing ####################
####################################################
include "includes/php/base.php";
mysqli_select_db($conn, 'drumsinthedeep');
$sql = "SELECT * FROM users";
$query = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html>
<head>
<title>Example PHP</title>
</head>
<body>
<?php
//We use a while loop to loop through each result.
//This is usefule, because it will not start if the result brings back 0 results.
while($result = mysqli_fetch_assoc($query)){
example($result['username']);
?>
<h1><?= $result['username']?></h1>
<?php
}
?>
</body>
<script>
//Some js code here!
</script>
</html>
<?php
#####################################################
################ PHP Functions ######################
#####################################################
function example($username){
echo $username;
}