-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpast_problem.php
More file actions
49 lines (43 loc) · 1.12 KB
/
past_problem.php
File metadata and controls
49 lines (43 loc) · 1.12 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
<?php
session_start() ;
$db_host = 'localhost' ;
$db_database = 'pd course' ;
$db_username = 'root' ;
$connection = mysql_connect($db_host, $db_username, 'pdogsserver');
if (!$connection)
die ("connection failed".mysql_error()) ;
mysql_query("SET NAMES 'utf8'");
$selection = mysql_select_db($db_database) ;
if (!$selection)
die ("selection failed".mysql_error()) ;
if (!isset($_SESSION['account'])){
header ("Location:index.php") ;
} else {
$query_past = "SELECT past_id FROM past_hw";
$past_id = mysql_query($query_past);
?>
<div class="hero-unit upload_section">
<p>Past Problems</p>
<table class="table table-hover">
<?php
$count = 0;
while ($fetch_past = mysql_fetch_row($past_id)){
if ($count%3 == 0) echo '<tr>';?>
<td>
<button type='button' class='btn btn-link btn-large past-btn' name='<?php echo $fetch_past[0]?>'><?php echo $fetch_past[0]; ?></button>
</td>
<?php
if ($count%3 == 2){
echo '</tr>';
$count = 0;
} else {
$count++;
}
}
?>
</table>
</div>
<script src="js/past.js"></script>
<?php
}
?>