Page 1 of 1

Having problems with inherited code...

Posted: Thu Jun 25, 2009 10:03 am
by kirkk
I'm working on a project started by someone else and having problems with their code not working. Basically it's supposed to be getting the page name and then looking up a record in MySQL to pull content to be used on the webpage. It's not pulling any of the information referenced in the page... description, title, id, content. I've pasted the relevant code below and any help you can provide would be greatly appreciated.

Cheers!
Kirk

Code: Select all

 
<?php include("includes/MySQL_Functions.php"); include("includes/page_functions.php");
    $mysql = new MySQL_Functions();
    $mysql->connect();
    $page = $mysql->query("SELECT * FROM pages WHERE url='".mysql_real_escape_string($_SERVER['PHP_SELF'])."' LIMIT 1", "single");
    if($page==""){
            $mysql->insert("INSERT INTO pages(url, title, description, content) VALUES('".mysql_real_escape_string($_SERVER['PHP_SELF'])."', '".mysql_real_escape_string(basename($_SERVER['SCRIPT_NAME']))."', ' ', 'Lorem ipsum dolor sit amet.')");
            $page = $mysql->query("SELECT * FROM pages WHERE id='".$mysql->get_last_id()."' LIMIT 1", "single");
        if(isset($_COOKIE['admin'])){
        }else{
            $mysql->close();
            redirect("./");
        }
    }
    //$galleries = $mysql->query("SELECT gallery.id, gallery.name FROM gallery, page_gallery WHERE gallery.id=page_gallery.gallery_id AND page_gallery.page_id='".$page["id"]."'");
    $mysql->close();
    
?>
 
<meta name="description" content="<?=$page["description"]?>" />
<title><?=$page["title"]?></title>
<?php if(isset($_COOKIE['admin'])){?><a href="edit_page.php?edit-field=<?=$page["id"]?>" rel="lyteframe[EditPage]" title="Page Editor" rev="width: 800px; height: 600px; scrolling: no;">Edit Page</a><br /><br /><?php }?>
<?=$page["content"]?>
 

Re: Having problems with inherited code...

Posted: Thu Jun 25, 2009 10:48 am
by divito
Any error messages?

Re: Having problems with inherited code...

Posted: Thu Jun 25, 2009 11:01 am
by kirkk
divito wrote:Any error messages?
Thanks for the reply. Not getting any error messages but a couple of things I'm seeing...

The page title (which should be 'index.php') is just displaying the php code... <?=$page["title"]?>

Also... at the very top-left corner of the page it shows " /> which is the very end of the line...

<meta name="description" content="<?=$page["description"]?>" />

Also... this is running on a Windows 2003 Server under IIS using PHP 5.2.9 and MySQL 5.1.35.

Hope this helps. Thanks again!

Kirk

Re: Having problems with inherited code...

Posted: Sat Jun 27, 2009 4:06 pm
by Darhazer
short_tags are disabled on your server, that's why the page title is not displayed correctly. Enable them in your php.ini