-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·86 lines (74 loc) · 3.61 KB
/
index.php
File metadata and controls
executable file
·86 lines (74 loc) · 3.61 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
<?php //index.php
/**
* Based on demo_list_pager.php along with demo_view_pager.php provides a sample web application
*
* The difference between demo_list.php and demo_list_pager.php is the reference to the
* Pager class which processes a mysqli SQL statement and spans records across multiple
* pages.
*
* The associated view page, demo_view_pager.php is virtually identical to demo_view.php.
* The only difference is the pager version links to the list pager version to create a
* separate application from the original list/view.
*
* @package itc250-16q2
* @author monkeework <monkeework@gmail.com>
* @version 3.02 2011/05/18
* @link http://www.monkeework.com/
* @license http://www.apche.org/licenses/LICENSE-2.0
* @see survey_view.php
* @see Pager.php
* @todo none
*/
//pathing/wiring info deets
// '../' works for a sub-folder. use './' for the root
require '../inc_0700/config_inc.php'; #provides configuration, pathing, error handling, db credentials
// SQL statement
$sql = "select SurveyID, Title, LastUpdated from 16q2_surveys";
//Fills <title> tag. If left empty will default to $PageTitle in config_inc.php
$config->titleTag = 'Survey App';
#Fills <meta> tags. Currently we're adding to the existing meta tags in config_inc.php
$config->metaDescription = 'ITC250 2016 ' . $config->metaDescription;
$config->metaKeywords = 'ITC250, PHP,'. $config->metaKeywords;
/*
$config->metaDescription = 'Web Database ITC281 class website.'; #Fills <meta> tags.
$config->metaKeywords = 'SCCC,Seattle Central,ITC281,database,mysql,php';
$config->metaRobots = 'no index, no follow';
$config->loadhead = ''; #load page specific JS
$config->banner = ''; #goes inside header
$config->copyright = ''; #goes inside footer
$config->sidebar1 = ''; #goes inside left side of page
$config->sidebar2 = ''; #goes inside right side of page
$config->nav1["page.php"] = "New Page!"; #add a new page to end of nav1 (viewable this page only)!!
$config->nav1 = array("page.php"=>"New Page!") + $config->nav1; #add a new page to beginning of nav1 (viewable this page only)!!
*/
# END CONFIG AREA ----------------------------------------------------------
get_header(); #defaults to theme header or header_inc.php
?>
<h3 align="center"><?=smartTitle();?> / Surveys List</h3>
<p>This page, along with <b>demo_view_pager.php</b>, demonstrate a List/View web application.</p>
<?php
#reference images for pager
$prev = '<img src="' . VIRTUAL_PATH . 'images/arrow_prev.gif" border="0" />';
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
# Create instance of new 'pager' class
$myPager = new Pager(2,'',$prev,$next,'');
$sql = $myPager->loadSQL($sql); #load SQL, add offset
# connection comes first in mysqli (improved) function
$result = mysqli_query(IDB::conn(),$sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
if(mysqli_num_rows($result) > 0)
{#records exist - process
if($myPager->showTotal()==1){$itemz = "survey";}else{$itemz = "surveys";} //deal with plural
echo '<div align="center">We have ' . $myPager->showTotal() . ' ' . $itemz . '!</div>';
while($row = mysqli_fetch_assoc($result))
{# process each row
echo '<div align="center"><a href="' . VIRTUAL_PATH . //'demo/demo_view_pager.php?id=' .
'surveys/survey_view.php?id=' .(int)$row['SurveyID'] . '">' . dbOut($row['Title']) . '</a>';
echo ' <i>Updated</i> <font color="red">$' . $row['LastUpdated'] . '</font></div>';
}
echo $myPager->showNAV(); # show paging nav, only if enough records
}else{#no records
echo "<div align=center>No Surveys Available</div>";
}
@mysqli_free_result($result);
get_footer(); #defaults to theme footer or footer_inc.php
?>