Hey all,
I am learning php and my first goal is to create a simple CMS. At the moment I am stuck on not being able to pull page names and their id`s from my DB and combine them into a list of links (like so/manage_pages.php?page_id=1) so I could grab id`s later for update and delete pages. Problem is when I load the page none of the links are displayed. My php5 is set up so that I could see all of the errors but there are none displayed nor is there anything in the log.
Here are the function I am using:
Code: [Select]<?php
function confirm_query($result_set) {
if (!$result_set) {
die("Database query failed: " . mysql_error());
}
}
function get_all_pages() {
global $connection;
mysql_select_db("content_MS", $connection);
$query = "SELECT *
FROM pages
ORDER BY id ASC";
$result_set = mysql_query($query, $connection);
confirm_query($result_set);
return $result_set;
}
function list_pages(){
global $connection;
$result = get_all_pages();
$output = "<div>";
$output .= "<p>Select the page you would like to edit:</p>";
while($row = mysql_fetch_array($result))
{
$output .="<ul>";
$output .= "<li>";
$output .= "<a href="manage_pages.php?page=" . urlencode($row["id"]) ."">{$row["page_name"]}</a></li>";
$output .="</ul>";
}
$output .="</div>";
return $output;
}
?>
Then I simply echo list_pages function on a page:
Code: [Select]<?php include ("includes/header.php"); ?>
<div id="content">
<div class="in">
<h2>This is the main content</h2>
<?php list_pages();?>
</div>
</div>
<?php include ("includes/footer.php"); ?>
And below is the html code I see when I load the page:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Content Manager - Manage Pages</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="css/back_css.css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="header">
<div class="in">
<h1>Welcome To Your Content Manager!</h1>
</div>
</div>
<div id="content-wrapper"> <div id="content">
<div class="in">
<h2>This is the main content</h2>
</div>
</div>
</div>
<div id="left"><div class="in">
<h2>Menu</h2>
<ul>
<li><a href="manage_pages.php?name=Manage Pages"> Manage Pages </a></li>
<li><a href="manage_menu.php?name=Manage Menu"> Manage Menu </a></li>
<li><a href="manage_albums.php?name=Manage Albums"> Manage Albums </a></li>
<li><a href="manage_videos.php?name=Manage Videos"> Manage Videos</a></li>
<li><a href="manage_gigs.php?name=Manage Gigs"> Manage Gigs </a></li>
<li><a href="manage_news.php?name=Manage News"> Manage News</a></li>
</ul>
</div></div>
<div id="footer"><span>by AB</span></div>
</div>
</body>
</html>
Any ideas ?
Thanks in advance !
need help in update query
hi i have a dynamic form. i need help in how can i use update query when values from dynamic form get pass to php file.currently when i press submit it displays this and does not update fieldsCode:
MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them in database. I have issues while inserting...foreach ($sentences as $final) {......else {
Reduce redundancies in switch functions?
Hello all! I somewhat new to PHP, and was wondering if anyone could give some suggestions on a switch function to reduce redundancies, and to efficaciously implement the script on to other
Email "$"
Hello!!Any PHP guy with a bit of a knowledge in Flash ?When I send a JPEG from flash how to get it to email in PHP.
Why is this function returning a false value when it shouldn't be??
This is in an include file. I want it to check a value in an html form and see if it's just white space, is numbers, is empty etc.Code: (text) [Select]<?phpfunction
OPINIONS WANTED
This is my login page code, and I want your opinion on it please! Code: // Login ~ CHECKS THE (USERNAME/PASSWORD) ENTERED BY THE USER THEN EITHER GRANTS ACCESS OR DENIEDS ACCESS case
admin with my register system?
Hey i wana make it so i can make a admin level on my register system , I'm kinda new to php to im not sure how, i wana do something like a 'if' statment so when they click the page if the admin level
Schedule editor
Hi,
Taking an HTML form and a PHP program and making it into one working file.
Hello, So I would like to display everything INSIDE a specific directory. In other words, I would like to display all file name's inside all subfolders in a specific directory. (NOT the subfolder
how to get values from $_Post with onchange="form.submit();"?
Hi, I have a form that submit to itself with a file upload field and two other hidden field values.If I put a submit button on the page, all is working fine.I don't like the submit button as its