Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 致命错误:在中调用未定义的函数get_all_subjects()_Php - Fatal编程技术网

Php 致命错误:在中调用未定义的函数get_all_subjects()

Php 致命错误:在中调用未定义的函数get_all_subjects(),php,Php,我试着自学PHP和MySQL。请注意,我对这个很陌生。下面是我收到的错误消息和所有代码 我希望这是有意义的 致命错误:在第9行的/Users/darren/Sites/widget_corp/content.php中调用未定义的函数get_all_subjects() content.php代码 内容区 这是我的函数代码它位于一个名为“includes”的文件夹中 您的函数代码有一个错误的开头您的函数代码有一个错误的开头 <?php require_once("includes/c

我试着自学PHP和MySQL。请注意,我对这个很陌生。下面是我收到的错误消息和所有代码

我希望这是有意义的

致命错误:在第9行的/Users/darren/Sites/widget_corp/content.php中调用未定义的函数get_all_subjects()

content.php代码


内容区
这是我的函数代码它位于一个名为“includes”的文件夹中


您的函数代码有一个错误的开头
您的函数代码有一个错误的开头

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
<table id="structure">
<tr>
<td id="navigation">
<ul class="subjects">
<?php
$subject_set = get_all_subjects(); **// this is the problem line**
while ($subject = mysql_fetch_array($subject_set)) {
echo "<li><a href=\"content.php?subj=" . urlencode($subject["id"]) . 
    "\">{$subject["menu_name"]}</a></li>";
$page_set = get_pages_for_subject($subject["id"]);
echo "<ul class=\"pages\">";
while ($page = mysql_fetch_array($page_set)) {
    echo "<li><a href=\"content.php?page=" . urlencode($page["id"]) .
        "\">{$page["menu_name"]}</a></li>";
}
echo "</ul>";
}

?>
</ul>
</td>
<td id="page">
<h2>Content Area</h2>

</td>
</tr>
</table>
<?php require("includes/footer.php"); ?>
</php
// This is where we store all the basic functions

function confirm_query($result_set) {
if (!$result_set) {
die("Database selection failed: " . mysql_error());
}       
}

function get_all_subjects() {
global $connection;
$query = "SELECT * 
FROM subjects 
ORDER BY position ASC";
$subject_set = mysql_query($query, $connection);
confirm_query($subject_set);
return $subject_set;
}

function get_pages_for_subject($subject_id) {
global $connection;
$query = "SELECT * 
FROM pages 
WHERE subject_id = {$subject_id"} 
ORDER BY position ASC";             
$page_set = mysql_query($query, $connection);
confirm_query($page_set);
return $page_set;   
}
?>