Hello,
I have two functions (below), which are meant to read which page a user is on, and then display the appropriate page information based on that page. When you are on index.php?page=home, all is fine and well, but once you go to index.php?page=profile or any other page, nothing shows up, or only the Home page data is displayed.
I ran a few simple tests that I could think of, like printing the $page variable to make sure I was actaully on that page (which I am). I then inserted some different text into get_Page_Data Function, case = profile, to test that it is reading the Case. It is. $page_data[3]="profile page"; Displays "profile page" on index.php?page=profile fine.
So, it would seem that the Function get_Page_Img_Details isn't calling the right page... is this true, and if so, how to remedy it?
Thanks,
yari
function get_Page_Img_Details ($page) {
if (!($link=mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD))) {
displayErrMsg(sprintf("error connecting to db %d:%s\n", mysql_errno(), mysql_error()));
exit();
}
$page=addslashes($page);
if (!($result=mysql_db_query(DB, "select pages_img.*, page_id, page_name, page_order, page_grouping, page_grouping_order, page_title, page_title_img, page_img_filename01, page_text_title01, page_text01, page_available from pages_img"))) {
displayErrMsg(sprintf("error doing select %d:%s\n", mysql_errno(), mysql_error()));
exit();
}
$row=mysql_fetch_array($result);
return $row;
} // End function get_Page_Img_Details
function get_Page_Data ($page) {
$page_img_details=get_Page_Img_Details($page);
switch ($page) {
case "home":$page_data[0]=$page_img_details["page_title"];
$page_data[1]=$page_img_details["page_title_img"];
$page_data[2]=$page_img_details["page_img_filename01"];
$page_data[3]=$page_img_details["page_text_title01"];
$page_data[4]=$page_img_details["page_text01"];
break;
case "profile":$page_data[0]=$page_img_details["page_title"];
$page_data[1]=$page_img_details["page_title_img"];
$page_data[2]=$page_img_details["page_img_filename01"];
$page_data[3]="profile page";
$page_data[4]=$page_img_details["page_text01"];
break;
}
return $page_data;
} // End function get_Page_Data