thanks I think no wrong with query it comes when I am doing the fetch command btw I put all in a simple file
<?php
//header
//mysql database connection
$connection = mysql_connect("localhost","root","ikillu");
if(!$connection){die(mysql_error()); }
//mysql database select
$db_select = mysql_select_db("mam_cop",$connection);
if(!$db_select){die(mysql_error());}
function get_subjects_all()
{
global $connection ;
$sub_query = "SELECT *
FROM subjects
ORDER BY position ASC";
$subject_query = mysql_query($sub_query,$connection)or die(mysql_error() . " IN $query");
//confirm_query($subject_query) ;
return $subject_query;
}
function get_pages_all($subject_id) {
global $connection;
$query = "SELECT *
FROM pages
WHERE subject_id = '$subject_id'
ORDER BY position ASC";
$page_set = mysql_query($query, $connection) or die(mysql_error() . " IN $query");
//confirm_query($page_set);
return $page_set;
}
$subject_query = get_subjects_all();
while($subject = mysql_fetch_array($subject_query))
{
echo $subject["menu_name"] . "<br />" ;
}
$all_pages = get_pages_all($subject["id"]);
while($page = mysql_fetch_array($all_pages))
{
echo $page["menu_name"] . "<br />" ;
}
?>
so you can figure easlly btw
$subject_id called with $subject["id"] which is table -> row named id it continus id : 1 , 2 , .. etc