I am trying to get a php/MySQL script to work, but it keeps giving me problems. I am trying to setup a page where a PHP script grabs link ID's and Names from a database and displays them to the user. Then from that page, the user is taken to a page where they are shown content based on the link that they clicked. The content that is displayed is determined by the ID that was selected on the previous page.
The problem is that my database queries to retrieve the page content all fail.
Here is the code:
// This function converts a category ID to a category name
function get_page_name($catid)
{
$conn = db_connect();
$query = 'select catname
from Categories
where catid = $catid';
$result = @mysql_query($query);
if(!$result)
return false;
}
// Returns an array of information corresponding to current ID
function get_page_content($catid)
{
// query database for a list of the categories/page links
$conn = db_connect();
$query = 'select pagecontent
from Categories
where catid = $catid';
$result = @mysql_query($query);
if (!$result)
return false;
return $result;
}
If anybody has any ideas as to what the problem would be, could you help me out?