本文整理汇总了PHP中dbOut函数的典型用法代码示例。如果您正苦于以下问题:PHP dbOut函数的具体用法?PHP dbOut怎么用?PHP dbOut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbOut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor for survey class
*
* Loads data from survey table
*
* @param in $id number of current survey
* @return void
* @todo none
*/
public function __construct($id)
{
$id = (int) $id;
#cast to integer
$sql = "select Title, Description from sp15_surveys where SurveyID={$id}";
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
#there are records - present data
while ($row = mysqli_fetch_assoc($result)) {
# pull data from associative array
$this->Title = dbOut($row['Title']);
$this->Description = dbOut($row['Description']);
$this->SurveyID = $id;
$this->isValid = true;
}
# Endwhile
}
# Endif
@mysqli_free_result($result);
}
示例2: showCustomers
function showCustomers()
{
//Select Customer
global $config;
get_header();
echo '<h3 align="center">' . smartTitle() . '</h3>';
$sql = "select CustomerID,FirstName,LastName,Email from test_Customers";
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
//show results
echo '<table align="center" border="1" style="border-collapse:collapse" cellpadding="3" cellspacing="3">';
echo '<tr>
<th>CustomerID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
';
while ($row = mysqli_fetch_assoc($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
echo '<tr>
<td>' . (int) $row['CustomerID'] . '</td>
<td>' . dbOut($row['FirstName']) . '</td>
<td>' . dbOut($row['LastName']) . '</td>
<td>' . dbOut($row['Email']) . '</td>
</tr>
';
}
echo '</table>';
} else {
//no records
echo '<div align="center"><h3>Currently No Customers in Database.</h3></div>';
}
echo '<div align="center"><a href="' . THIS_PAGE . '?act=add">ADD CUSTOMER</a></div>';
@mysqli_free_result($result);
//free resources
get_footer();
}
示例3: responseList
function responseList($id)
{
$myReturn = '';
$sql = "select DateAdded, ResponseID from sm15_responses where SurveyID = {$id}";
#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(10, '', $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 = "response";
} else {
$itemz = "responses";
}
//deal with plural
$myReturn .= '<div align="center">We have ' . $myPager->showTotal() . ' ' . $itemz . '!</div>';
while ($row = mysqli_fetch_assoc($result)) {
# process each row
$myReturn .= '<div align="center"><a href="' . VIRTUAL_PATH . 'surveys/response_view.php?id=' . (int) $row['ResponseID'] . '">' . dbOut($row['DateAdded']) . '</a>';
$myReturn .= '</div>';
}
$myReturn .= $myPager->showNAV();
# show paging nav, only if enough records
} else {
#no records
$myReturn .= "<div align=center>There are currently no surveys</div>";
}
@mysqli_free_result($result);
//$myReturn .= $id;
return $myReturn;
}
示例4: mysqli
# Will change to true, if record found!
# connection comes first in mysqli (improved) function
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
echo "<h3 style='text-align: center'>News Feeds Available</h3>";
if (mysqli_num_rows($result) > 0) {
#records exist - process
$foundRecord = TRUE;
/**
*
* COLUMNS
*
*/
echo "<ul id='feedlist'>";
while ($row = mysqli_fetch_assoc($result)) {
$Title = dbOut($row['FeedName']);
$Link = dbOut($row['FeedURL']);
if ($foundRecord) {
#records exist - show muffin!
?>
<li style="text-align: center"><a href="news_feed.php?url=<?php
echo $Link;
?>
"<h3><?php
echo $Title;
?>
</h3></a></li>
<hr>
<?php
} else {
//no such muffin!
echo '<div align="center">No Items Match Category.</div>';
示例5: __construct
/**
* Constructor for Response class.
*
* @param integer $id ID number of Response
* @return void
* @todo none
*/
function __construct($id)
{
$this->ResponseID = (int) $id;
if ($this->ResponseID == 0) {
return FALSE;
}
# invalid response id - abort
$iConn = \IDB::conn();
# uses a singleton DB class to create a mysqli improved connection
$sql = sprintf("select SurveyID, DateAdded from " . PREFIX . "responses where ResponseID =%d", $this->ResponseID);
$result = mysqli_query($iConn, $sql) or die(trigger_error(mysqli_error($iConn), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
# returned a response!
while ($row = mysqli_fetch_array($result)) {
# load singular response object properties
$this->SurveyID = (int) $row['SurveyID'];
$this->DateTaken = dbOut($row['DateAdded']);
}
} else {
return FALSE;
#no responses - abort
}
mysqli_free_result($result);
parent::__construct($this->SurveyID);
# access parent class to build Question & Answers
# attempt to load choice array of Answer objects
if ($this->TotalQuestions > 0) {
# Questions must exist for this survey, if we are to proceed
$sql = sprintf("select AnswerID, QuestionID, RQID from " . PREFIX . "responses_answers where ResponseID=%d order by QuestionID asc", $this->ResponseID);
$result = mysqli_query($iConn, $sql) or die(trigger_error(mysqli_error($iConn), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
# must be choices
while ($row = mysqli_fetch_array($result)) {
# load data into array of choices
$this->aChoice[] = new Choice((int) $row['AnswerID'], (int) $row['QuestionID'], (int) $row['RQID']);
}
@mysqli_free_result($result);
}
}
}
示例6: number_format
$itemz = "muffins";
}
echo '<div align="center">We have ' . $myPager->showTotal() . ' ' . $itemz . '!</div>';
$tdWidth = number_format(100 / COLS, 0);
# Here we determine the number of columns we'll be using
$pos = 0;
#init position variable
echo '<table align="center" border="0" width="90%" style="border-collapse:collapse" cellpadding="10" cellspacing="10"><tr>';
while ($row = mysqli_fetch_assoc($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
$pos++;
//echo '<td class="myborder" width="' . $tdWidth . '%">'; #we can't place the class on the <td> in all browers
echo '<td width="' . $tdWidth . '%"><div class="myborder" align="center">';
echo '<img src="' . VIRTUAL_PATH . 'upload/m' . dbOut($row['MuffinID']) . '_thumb.jpg" hspace="5" vspace="5" align="middle" />';
echo ' <a href="' . VIRTUAL_PATH . 'demo/demo_view_curvy.php?id=' . dbOut($row['MuffinID']) . '">' . dbOut($row['MuffinName']) . '</a>';
echo '<br /><i>only</i> <font color="red">$' . money_format("%(#10n", dbOut($row['Price'])) . '</font>';
echo '</div></td>';
if ($pos % COLS === 0 && is_array($row)) {
echo '</tr><tr>';
}
}
while ($pos % COLS) {
#loop to fill in final row
echo '<td> </td>';
$pos++;
}
echo "</tr></table>";
echo $myPager->showNAV();
//show paging nav, only if enough records
} else {
#no records
示例7: editDisplay
function editDisplay()
{
global $config;
if ($_SESSION["Privilege"] == "admin") {
#use session data if logged in as admin only
$myID = (int) $_SESSION['AdminID'];
} else {
if (isset($_POST['AdminID']) && (int) $_POST['AdminID'] > 0) {
$myID = (int) $_POST['AdminID'];
#Convert to integer, will equate to zero if fails
} else {
feedback("AdminID not numeric", "error");
myRedirect($config->adminReset);
}
}
$privileges = getENUM(PREFIX . 'Admin', 'Privilege');
#grab all possible 'Privileges' from ENUM
$myConn = conn('', FALSE);
$sql = sprintf("select FirstName,LastName,Email,Privilege from " . PREFIX . "Admin WHERE AdminID=%d", $myID);
$result = @mysql_query($sql, $myConn) or die(trigger_error(mysql_error(), E_USER_ERROR));
if (mysql_num_rows($result) > 0) {
//show results
while ($row = mysql_fetch_array($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
$FirstName = dbOut($row['FirstName']);
$LastName = dbOut($row['LastName']);
$Email = dbOut($row['Email']);
$Privilege = dbOut($row['Privilege']);
}
} else {
//no records
//put links on page to reset form, exit
echo '
<div align="center"><h3>No such administrator.</h3></div>
<div align="center"><a href="' . $config->adminDashboard . '">Exit To Admin</a></div>
';
}
$config->loadhead = '
<script type="text/javascript" src="<?php echo VIRTUAL_PATH; ?>include/util.js"></script>
<script type="text/javascript">
function checkForm(thisForm)
{//check form data for valid info
if(empty(thisForm.FirstName,"Please enter first name.")){return false;}
if(empty(thisForm.LastName,"Please enter last name.")){return false;}
if(!isEmail(thisForm.Email,"Please enter a valid Email Address")){return false;}
return true;//if all is passed, submit!
}
</script>
';
get_header();
echo '
<h3 align="center">Edit Administrator</h3>
<form action="' . $config->adminEdit . '" method="post" onsubmit="return checkForm(this);">
<table align="center">
<tr>
<td align="right">First Name</td>
<td>
<input type="text" name="FirstName" value="' . $FirstName . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
<tr>
<td align="right">Last Name</td>
<td>
<input type="text" name="LastName" value="' . $LastName . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
<tr>
<td align="right">Email</td>
<td>
<input type="text" name="Email" value="' . $Email . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
';
if ($_SESSION["Privilege"] == "developer" || $_SESSION["Privilege"] == "superadmin") {
# uses createSelect() function to preload the select option
echo '
<tr>
<td align="right">Privilege</td>
<td>
';
# createSelect(element-type,element-name,values-array,db-array,labels-array,concatentator) - creates preloaded radio, select, checkbox set
createSelect("select", "Privilege", $privileges, $Privilege, $privileges, ",");
#privileges is from ENUM
echo '
</td>
</tr>';
} else {
echo '<input type="hidden" name="Privilege" value="' . $_SESSION["Privilege"] . '" />';
}
echo '
<input type="hidden" name="AdminID" value="', $myID . '" />
<input type="hidden" name="act" value="update" />
<tr>
<td align="center" colspan="2">
<input type="submit" value="Update Admin" />
<em>(<font color="red"><b>*</b> required field</font>)</em>
</td>
//.........这里部分代码省略.........
示例8: mysqli
$foundRecord = FALSE; # Will change to true, if record found!
# 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
$foundRecord = TRUE;
while ($row = mysqli_fetch_assoc($result))
{
$MuffinName = dbOut($row['MuffinName']);
$Description = dbOut($row['Description']);
$Price = (float)$row['Price'];
$MetaDescription = dbOut($row['MetaDescription']);
$MetaKeywords = dbOut($row['MetaKeywords']);
}
}
@mysqli_free_result($result); # We're done with the data!
if($foundRecord)
{#only load data if record found
$config->titleTag = $MuffinName . " muffins made with PHP & love!"; #overwrite PageTitle with Muffin info!
#Fills <meta> tags. Currently we're adding to the existing meta tags in config_inc.php
$config->metaDescription = $MetaDescription . ' Seattle Central\'s ITC280 Class Muffins are made with pure PHP! ' . $config->metaDescription;
$config->metaKeywords = $MetaKeywords . ',Muffins,PHP,Fun,Bran,Regular,Regular Expressions,'. $config->metaKeywords;
}
/*
$config->metaDescription = 'Web Database ITC281 class website.'; #Fills <meta> tags.
$config->metaKeywords = 'SCCC,Seattle Central,ITC281,database,mysql,php';
示例9: dbOut
echo '<table align="center" border="1" style="border-collapse:collapse" cellpadding="3" cellspacing="3">';
echo '<tr>
<th>SurveyID</th>
<th>DateAdded</th>
<th>Title</th>
<th>Description</th>
<th>AdminName</th>
</tr>
<tr>
<td>
<a href="' . VIRTUAL_PATH . 'surveys/survey_view.php?id=' . (int) $row['SurveyID'] . '">' . dbOut($row['SurveyID']) . '</a>
</td>
<td>' . dbOut($row['DateAdded']) . '</td>
<td>' . dbOut($row['Title']) . '</td>
<td>' . dbOut($row['Description']) . '</td>
<td>' . dbOut($row['AdminName']) . '</td>
</tr>
';
//. (int)$row['SurveyID'] .
}
echo '</table>';
echo $myPager->showNAV();
# show paging nav, only if enough records
} else {
#no records
echo "<div align=center>I'm sorry, there are currently no surveys.</div>";
}
@mysqli_free_result($result);
get_footer();
#defaults to theme footer or footer_inc.php
示例10: mysqli
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
#Create a connection
# connection comes first in mysqli (improved) function
$iConn = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(myerror(__FILE__, __LINE__, mysqli_connect_error()));
# Create instance of new 'pager' class
$myPager = new Pager(5, '', $prev, $next, '');
$sql = $myPager->loadSQL($sql, $iConn);
#load SQL, pass in existing connection, add offset
$result = mysqli_query($iConn, $sql) or die(myerror(__FILE__, __LINE__, mysqli_error($iConn)));
if (mysqli_num_rows($result) > 0) {
#records exist - process
if ($myPager->showTotal() == 1) {
$itemz = "beer";
} else {
$itemz = "beers";
}
//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 . 'beers_view.php?id=' . (int) $row['BeerID'] . '">' . dbOut($row['Beer']) . '</a>';
echo ' <i>Alcohol Content:</i> <font color="red">$' . number_format((double) $row['AlcoholContent'], 2) . '%</font></div>';
}
echo $myPager->showNAV();
# show paging nav, only if enough records
} else {
#no records
echo "<div align=center>What! No beers? There must be a mistake!!</div>";
}
@mysqli_free_result($result);
include 'include/footer.php';
示例11: showFavorites
function showFavorites()
{
//Select Favorites
global $config;
get_header();
echo '<h3 align="center">' . smartTitle() . '</h3>';
//$sql = "select CustomerID,FirstName,LastName,Email from test_Customers";
$sql = "select `FavoriteID`, `LastName`, `FirstName`, `Email`, `Title`, `URL`, `Description`, `Category`, `DateAdded` from sp15_Favorites";
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
//show results
echo '<table align="center" border="1" style="border-collapse:collapse" cellpadding="3" cellspacing="3">';
echo '<tr>
<th>FavoriteID</th>
<th>LastName</th>
<th>FirstName</th>
<th>Email</th>
<th>Title</th>
<th>URL</th>
<th>Description</th>
<th>Category</th>
<th>DateAdded</th>
</tr>
';
while ($row = mysqli_fetch_assoc($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
echo '<tr>
<td>' . (int) $row['FavoriteID'] . '</td>
<td>' . dbOut($row['FirstName']) . '</td>
<td>' . dbOut($row['LastName']) . '</td>
<td>' . dbOut($row['Email']) . '</td>
<td>' . dbOut($row['Title']) . '</td>
<td>' . dbOut($row['URL']) . '</td>
<td>' . dbOut($row['Description']) . '</td>
<td>' . dbOut($row['Category']) . '</td>
<td>' . dbOut($row['DateAdded']) . '</td>
</tr>
';
}
echo '</table>';
} else {
//no records
echo '<div align="center"><h3>Currently No Favorites in Database.</h3></div>';
}
echo '<div align="center"><a href="' . THIS_PAGE . '?act=add">ADD FAVORITES</a></div>';
@mysqli_free_result($result);
//free resources
get_footer();
}
示例12: editDisplay
function editDisplay()
{
global $config;
if ($_SESSION["Privilege"] == "admin") {
#use session data if logged in as admin only
$myID = (int) $_SESSION['AdminID'];
} else {
if (isset($_POST['AdminID']) && (int) $_POST['AdminID'] > 0) {
$myID = (int) $_POST['AdminID'];
#Convert to integer, will equate to zero if fails
} else {
feedback("AdminID not numeric", "error");
myRedirect($config->adminReset);
}
}
$config->loadhead = '
<script type="text/javascript" src="' . VIRTUAL_PATH . 'include/util.js"></script>
<script type="text/javascript">
function checkForm(thisForm)
{//check form data for valid info
if(!isAlphanumeric(thisForm.PWord1,"Only alphanumeric characters are allowed for passwords.")){thisForm.PWord2.value="";return false;}
if(!correctLength(thisForm.PWord1,6,20,"Password does not meet the following requirements:")){thisForm.PWord2.value="";return false;}
if(thisForm.PWord1.value != thisForm.PWord2.value)
{//match password fields
alert("Password fields do not match.");
thisForm.PWord1.value = "";
thisForm.PWord2.value = "";
thisForm.PWord1.focus();
return false;
}
return true;//if all is passed, submit!
}
</script>
';
get_header();
$myConn = conn('', FALSE);
$sql = sprintf("select AdminID,FirstName,LastName,Email,Privilege from " . PREFIX . "Admin WHERE AdminID=%d", $myID);
$result = @mysql_query($sql, $myConn) or die(trigger_error(mysql_error(), E_USER_ERROR));
if (mysql_num_rows($result) > 0) {
//show results
while ($row = mysql_fetch_array($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
$Name = dbOut($row['FirstName']) . ' ' . dbOut($row['LastName']);
$Email = dbOut($row['Email']);
$Privilege = dbOut($row['Privilege']);
}
} else {
//no records
//put links on page to reset form, exit
echo '
<div align="center"><h3>No such administrator.</h3></div>
<div align="center"><a href="' . $config->adminDashboard . '">Exit To Admin</a></div>
';
}
echo '
<h3 align="center">Reset Administrator Password</h3>
<p align="center">
Admin: <font color="red"><b>' . $Name . '</b></font>
Email: <font color="red"><b>' . $Email . '</b></font>
Privilege: <font color="red"><b>' . $Privilege . '</b></font>
</p>
<p align="center">Be sure to write down password!!</p>
<form action="' . $config->adminReset . '" method="post" onsubmit="return checkForm(this);">
<table align="center">
<tr>
<td align="right">Password</td>
<td>
<input type="password" name="PWord1" />
<font color="red"><b>*</b></font> <em>(6-20 alphanumeric chars)</em>
</td>
</tr>
<tr>
<td align="right">Re-enter Password</td>
<td>
<input type="password" name="PWord2" />
<font color="red"><b>*</b></font>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="hidden" name="AdminID" value="' . $myID . '" />
<input type="hidden" name="act" value="update" />
<input type="submit" value="Reset Password!" />
<em>(<font color="red"><b>*</b> required field</font>)</em>
</td>
</tr>
</table>
</form>
<div align="center"><a href="' . $config->adminDashboard . '">Exit To Admin</a></div>
';
@mysql_free_result($result);
#free resources
get_footer();
}
示例13: Pager
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
# Create instance of new 'pager' class
$myPager = new Pager(10, '', $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="' . (int) $row['SurveyID'] . '" class="ajax">' . dbOut($row['Title']) . '</a>';
echo '</div>';
echo '<div class="survey" align="center" id="d' . (int) $row['SurveyID'] . '"> </div>';
}
echo $myPager->showNAV();
# show paging nav, only if enough records
} else {
#no records
echo "<div align=center>What! No surveys? There must be a mistake!!</div>";
}
@mysqli_free_result($result);
get_footer();
#defaults to theme footer or footer_inc.php
示例14: editDisplay
function editDisplay($nav1 = '')
{
if ($_SESSION["Privilege"] == "admin") {
#use session data if logged in as admin only
$myID = (int) $_SESSION['AdminID'];
} else {
if (isset($_POST['AdminID']) && (int) $_POST['AdminID'] > 0) {
$myID = (int) $_POST['AdminID'];
#Convert to integer, will equate to zero if fails
} else {
header('Location:' . ADMIN_PATH . THIS_PAGE);
die;
}
}
$iConn = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(myerror(__FILE__, __LINE__, mysqli_connect_error()));
$sql = sprintf("select FirstName,LastName,Email,Privilege from " . PREFIX . "Admin WHERE AdminID=%d", $myID);
$result = @mysqli_query($iConn, $sql) or die(myerror(__FILE__, __LINE__, mysqli_error($iConn)));
if (mysqli_num_rows($result) > 0) {
//show results
while ($row = mysqli_fetch_array($result)) {
//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
$FirstName = dbOut($row['FirstName']);
$LastName = dbOut($row['LastName']);
$Email = dbOut($row['Email']);
$Privilege = dbOut($row['Privilege']);
}
} else {
//no records
//put links on page to reset form, exit
echo '
<p align="center"><h3>No such administrator.</h3></p>
<p align="center"><a href="' . ADMIN_PATH . 'admin_dashboard.php">Exit To Admin</a></p>
';
}
$loadhead = '
<script type="text/javascript" src="' . VIRTUAL_PATH . 'include/util.js"></script>
<script type="text/javascript">
function checkForm(thisForm)
{//check form data for valid info
if(empty(thisForm.FirstName,"Please enter first name.")){return false;}
if(empty(thisForm.LastName,"Please enter last name.")){return false;}
if(!isEmail(thisForm.Email,"Please enter a valid Email Address")){return false;}
return true;//if all is passed, submit!
}
</script>
';
include INCLUDE_PATH . 'header.php';
echo '
<h1>Edit Administrator</h1>
<form action="' . ADMIN_PATH . THIS_PAGE . '" method="post" onsubmit="return checkForm(this);">
<table align="center">
<tr>
<td align="right">First Name</td>
<td>
<input type="text" autofocus required name="FirstName" value="' . $FirstName . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
<tr>
<td align="right">Last Name</td>
<td>
<input type="text" required name="LastName" value="' . $LastName . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
<tr>
<td align="right">Email</td>
<td>
<input type="email" required name="Email" value="' . $Email . '" />
<font color="red"><b>*</b></font>
</td>
</tr>
';
if ($_SESSION["Privilege"] == "developer" || $_SESSION["Privilege"] == "superadmin") {
# uses returnSelect() function to preload the select option
echo '
<tr>
<td align="right">Privilege</td>
<td>
';
#creates preloaded radio, select, checkbox set
$privileges = getENUM(PREFIX . 'Admin', 'Privilege', $iConn);
#grab all possible 'Privileges' from ENUM
echo returnSelect("select", "Privilege", $privileges, "", $privileges, ",");
echo '
</td>
</tr>';
} else {
echo '<input type="hidden" name="Privilege" value="' . $_SESSION["Privilege"] . '" />';
}
echo '
<input type="hidden" name="AdminID" value="', $myID . '" />
<input type="hidden" name="act" value="update" />
<tr>
<td align="center" colspan="2">
<input type="submit" value="Update Admin" />
<em>(<font color="red"><b>*</b> required field</font>)</em>
</td>
</tr>
</table>
//.........这里部分代码省略.........
示例15: mysqli
<p>This page shows the list of news categories that we offer!</p>
<p>Click any category to show news feeds available in that category.</p>
<!--<p>This page, along with <b>demo_view.php</b>, demonstrate a List/View web application.</p>
<p>It was built on the mysql shared web application page, <b>demo_shared.php</b></p>
<p>This page is the entry point of the application, meaning this page gets a link on your web site. Since the current subject is muffins, we could name the link something clever like <a href="<?php
echo VIRTUAL_PATH;
?>
demo_list.php">Muffins</a></p>
<p>Use <b>demo_list.php</b> and <b>demo_view.php</b> as a starting point for building your own List/View web application!</p>-->
<?php
# connection comes first in mysqli (improved) function
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
/**
*
* RESULTS HERE
*
*/
if (mysqli_num_rows($result) > 0) {
#records exist - process
while ($row = mysqli_fetch_assoc($result)) {
# process each row
echo '<div align="center"><a href="' . VIRTUAL_PATH . 'feed/news_view.php?id=' . (int) $row['CategoryID'] . '">' . dbOut($row['CategoryName']) . '</a>';
}
} else {
#no records
echo "<div align=center>No Records Found.</div>";
}
@mysqli_free_result($result);
get_footer();
#defaults to theme footer or footer_inc.php