I have three pages: group_data.php
, getters.php
, and homepage.php
the are all contained in two different directories;
home
is in the root folder, while both group_data.php
and getters.php
are in the inc/modules/
sub-folder;
inc/modules/group_data.php
, inc/modules/getters.php
this is the code in my group_data.php page:
function getComments($post_id){
$sql_query = mysql_query("SELECT * FROM replies WHERE pid = '$post_id'");
$row_count = mysql_num_rows($sql_query);
while($rows = mysql_fetch_assoc($sql_query)) {
$record_set[] = array('comment_count' => $row_count,
'pid' => $rows['pid'],
'date' => timeAgo($rows['date']),
'comment' => $rows['comment']
);
}
return $record_set;
}
function getFollowedGroupPosts($user_id){
$sql_query = mysql_query("SELECT gid FROM members WHERE uid = '$user_id'");
$row_count = mysql_num_rows($sql_query);
while( $rows = mysql_fetch_assoc($sql_query)) {
$tag = $rows['gid'];
$pushed_array = array_fill(0, $row_count, $tag );
$ids = join("','",$pushed_array);
$sql_bound = mysql_query("SELECT * FROM posts WHERE gid IN ('$ids')");
$row_count_b = mysql_num_rows($sql_bound);
while( $rows_b = mysql_fetch_assoc($sql_bound)) {
//get images url as comma seperated strings
$url_string = json_encode(getPostImages($rows_b['pid']));
$record_set[] = array('gid' => $rows_b['gid'],
'pid' => $rows_b['pid'],
'post' => $rows_b['post'],
'images' => getPostImages($rows_b['pid']),
'jImages' => $url_string,
'videos' => getPostVideos($rows_b['pid']),
'audios' => getPostAudios($rows_b['pid']),
'date' => timeAgo($rows_b['date']),
'username' => userIdToName($rows_b['uid']),
'filemap_id' => $rows_b['filemap_id'],
'group_name' => groupIdToName($rows_b['gid']),
'comments' => getComments($rows_b['pid']),
'likes' => checkLikeCount($rows_b['pid']),
'post_count' => $row_count_b);
}
}
return $record_set;
}
calling the getfollowedGroupPosts()
function works on the getters.php page, but including the getters.php page in homepage.php trows a the error below;
Fatal error: Call to undefined function getComments() in C:\xampp\server\htdocs\bridgoo\inc\modules\getters.php on line 5
what could be the problem