本文整理汇总了PHP中find_subject_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP find_subject_by_id函数的具体用法?PHP find_subject_by_id怎么用?PHP find_subject_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_subject_by_id函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_selected_pages
function find_selected_pages($public = false)
{
global $current_subject;
global $current_page;
if (isset($_GET["subject"])) {
//use get request to get my subject id
$selected_subject_id = $_GET["subject"];
//get my subject details by id from the database
$current_subject = find_subject_by_id($selected_subject_id, $public);
$selected_page_id = null;
if ($current_subject && $public) {
$current_page = find_default_page_for_subject($current_subject["id"]);
} else {
$current_page = null;
}
} elseif (isset($_GET["page"])) {
$selected_subject_id = null;
$current_subject = null;
$selected_page_id = $_GET["page"];
$current_page = find_page_by_id($selected_page_id);
} else {
$selected_subject_id = null;
$current_subject = null;
$selected_page_id = null;
$current_page = null;
}
}
示例2: find_selected_page
function find_selected_page()
{
global $current_subject;
global $current_page;
if (isset($_GET["subject"])) {
$current_subject = find_subject_by_id($_GET["subject"]);
$current_page = null;
} elseif (isset($_GET["page"])) {
$current_subject = null;
$current_page = find_page_by_id($_GET["page"]);
} else {
$current_subject = null;
$current_page = null;
}
}
示例3: find_selected_page
function find_selected_page($public = false)
{
global $current_subject;
global $current_page;
if (isset($_GET["subject"])) {
$current_subject = find_subject_by_id($_GET["subject"], $public);
if ($current_subject && $public) {
$current_page = find_default_page_for_subject($current_subject["id"]);
} else {
$current_page = null;
}
} elseif (isset($_GET["page"])) {
$current_page = find_page_by_id($_GET["page"], $public);
$current_subject = null;
} else {
$current_subject = null;
$current_page = null;
}
}
示例4: confirm_logged_in
<?php
require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
confirm_logged_in();
?>
<?php
$current_subject = find_subject_by_id($_GET["subject"], false);
if (!$current_subject) {
// subject ID was missing or invalid or
// subject couldn't be found in database
redirect_to("manage_contenct.php");
}
$pages_set = find_pages_for_subject($current_subject["id"]);
if (mysqli_num_rows($pages_set) > 0) {
$_SESSION["message"] = "Can't delete a subject with pages.";
redirect_to("manage_content.php?subject={$current_subject["id"]}");
}
$id = $current_subject["id"];
$query = "DELETE FROM subjects WHERE id = {$id} LIMIT 1";
$result = mysqli_query($connection, $query);
if ($result && mysqli_affected_rows($connection) == 1) {
// Success
$_SESSION["message"] = "Subject deleted.";
redirect_to("manage_content.php");
} else {
// Failure
$_SESSION["message"] = "Subject deletion failed.";
redirect_to("manage_content.php?subject={$id}");
示例5: find_subject_by_id
<?php
require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
?>
<?php
$current_subject = find_subject_by_id($_GET["subject"]);
if (!$current_subject) {
// subject ID was missing or invalid or
// subject couldn't be found in database
redirect_to("manage_content.php");
}
$pages_set = find_pages_for_subject($current_subject["id"], false);
if (mysqli_num_rows($pages_set) > 0) {
$_SESSION["message"] = "Can't delete a subject with pages.";
redirect_to("manage_content.php?subject={$current_subject["id"]}");
}
$id = $current_subject["id"];
$query = "DELETE FROM subjects WHERE id = {$id} LIMIT 1";
$result = mysqli_query($connection, $query);
if ($result && mysqli_affected_rows($connection) == 1) {
// Success
$_SESSION["message"] = "Subject deleted.";
redirect_to("manage_content.php");
} else {
// Failure
$_SESSION["message"] = "Subject deletion failed.";
redirect_to("manage_content.php?subject={$id}");
}
示例6: find_selected_page
function find_selected_page($public = false)
{
global $current_page;
global $current_subject;
if (isset($_GET["subject"])) {
// This is an associative array with all the database info
$current_subject = find_subject_by_id($_GET["subject"], $public);
if ($current_subject && $public) {
$current_page = find_default_page_for_subject($current_subject["id"]);
} else {
$current_page = null;
}
} elseif (isset($_GET["page"])) {
$current_subject = null;
$current_page = find_page_by_id($_GET["page"], $public);
} else {
$current_page = null;
$current_subject = null;
}
}
示例7: navigation
$selected_page_id = null;
}
?>
<div id="main">
<div id="navigation">
<?php
echo navigation($selected_subject_id, $selected_page_id);
?>
</div>
<div id="page">
<?php
if ($selected_subject_id) {
?>
<h2>Manage Subject</h2>
<?php
$current_subject = find_subject_by_id($selected_subject_id);
?>
Menu name: <?php
echo $current_subject["menu_name"];
?>
<br />
<?php
} elseif ($selected_page_id) {
?>
<h2>Manage Page</h2>
<?php
$current_page = find_page_by_id($selected_page_id);
?>
Menu name: <?php
echo $current_page["menu_name"];
示例8: find_selected_page
function find_selected_page($public = false)
{
global $current_subject;
global $current_page;
//instead of returning we can make it as a global variable
if (isset($_GET["subject"])) {
$current_subject = find_subject_by_id($_GET["subject"], $public);
if ($current_subject && $public) {
$current_page = default_page_for_subject($current_subject["id"]);
# default page for subject }
} else {
$current_page = null;
}
} elseif (isset($_GET["page"])) {
$current_page = find_page_by_id($_GET["page"], $public);
# for not displaying the invisible pages
$current_subject = null;
} else {
# for coming from admin page
$current_subject = null;
$current_page = null;
}
}
示例9: find_selected_page
function find_selected_page()
{
global $current_subject;
// creating them in the global scope
global $current_page;
// creating them in the global scope
if (isset($_GET["subject"])) {
$current_subject = find_subject_by_id($_GET["subject"]);
$current_page = null;
} elseif (isset($_GET["page"])) {
$current_page = find_page_by_id($_GET["page"]);
$current_subject = null;
} else {
$current_subject = null;
$current_page = null;
}
}