Having problems with inherited code...
Posted: Thu Jun 25, 2009 10:03 am
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
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"]?>