ok here's the db code what i want to do is take everything under function getCategories () including function getCategories () to move the page links but when i try moving it to another file it gives me a error saying Fatal error: Call to undefined function: getcategories() in /home/layoutst/public_html/Graphics/index.php on line 14
here's what in index.php
This is index.php
require 'db.php';
getCategories(); //this is line 14 where the error is occuring
echo '<h2>Latest 10 Added Graphics</h2>';
echo '<div align="center">';
$fetch = mysql_query("SELECT * FROM graphics LEFT JOIN categories ON ( graphicCategoryID = categoryID ) LEFT JOIN parents ON ( graphicParentID = parentID ) ORDER BY graphicID DESC LIMIT 10");
while ( $row = mysql_fetch_assoc ( $fetch ) )
{
if ( is_numeric ( $row['graphicID'] ) )
{
?>
<p>
<a href="/Graphics/<?=$row['parentPerm'];?>-<?=$row['categoryPerm'];?>.html"><img src="<?=$row['graphicURL'];?>" alt="" border="0" /></a>
<h3><?=$row['graphicName'];?> myspace graphics<br /><a href="/Graphics/<?=$row['parentPerm'];?>-<?=$row['categoryPerm'];?>.html"><?=$row['categoryName'];?></a></h3>
</p>
<?
This is db.php
<?php
define ( 'LIMIT', 20 );
mysql_connect ( 'localhost', 'USER', 'PASS' )
or die(mysql_error());
mysql_select_db ( 'layoutst_graphics' )
or die(mysql_error());
function getCategories ()
{
$fetch = mysql_query("SELECT * FROM categories LEFT JOIN parents ON ( categoryParentID = parentID ) GROUP BY parentName, categoryName");
$parentName = "";
while ( $row = mysql_fetch_assoc ( $fetch ) )
{
if ( $parentName != $row['parentName'] )
{
echo '<p><strong><a href="/Graphics/'.$row['parentPerm'].'.html">'.$row['parentName'].'</a></strong></p>';
$parentName = $row['parentName'];
}
echo '<a href="/Graphics/'. $row['parentPerm'].'-' . $row['categoryPerm'] . '.html">'. $row['categoryName'] . '</a><br />';
}
}
function makePermalink ( $i )
{
$url = ereg_replace('[^A-Za-z0-9]', ' ', $i);
$url = preg_replace('/\s\s+/', ' ', $url);
$url = str_replace(' ', '_', $url);
$url = trim_end_thing($url);
$url = strtolower($url);
return $url;
}
function trim_end_thing ($text)
{
if ( $text{strlen($text) -1} == "_" )
{
$text = substr_replace($text, "", strlen($text) -1);
}
return $text;
}
?>
where im trying to copy the code into is my footer which is the navigation
here's the code
<h2>Categories</h2>
<ul>
<li><a href="http://layoutstreet.com/rap-myspace-layouts/">Rap Layouts</a></li>
<li><a href="http://layoutstreet.com/money-myspace-layouts/">Money Layouts</a></li>
<li><a href="http://layoutstreet.com/quotes-myspace-layouts/">Quote Layouts</a></li>
<li><a href="http://layoutstreet.com/fashion-myspace-layouts/">Fashion Layouts</a></li>
<li><a href="http://layoutstreet.com/cartoons-myspace-layouts/">Cartoon Layouts</a></li>
<li><a href="http://layoutstreet.com/models-myspace-layouts/">Model Layouts</a></li>
<li><a href="http://layoutstreet.com/sports-myspace-layouts/">Sports Layouts</a></li>
<li><a href="http://layoutstreet.com/miscellaneous-myspace-layouts/">Misc Layouts</a></li>
<li><a href="http://layoutstreet.com/cars-myspace-layouts/">Car Layouts</a></li>
function getCategories ()
{
$fetch = mysql_query("SELECT * FROM categories LEFT JOIN parents ON ( categoryParentID = parentID ) GROUP BY parentName, categoryName");
$parentName = "";
while ( $row = mysql_fetch_assoc ( $fetch ) )
{
if ( $parentName != $row['parentName'] )
{
echo '<p><strong><a href="/Graphics/'.$row['parentPerm'].'.html">'.$row['parentName'].'</a></strong></p>';
$parentName = $row['parentName'];
}
echo '<a href="/Graphics/'. $row['parentPerm'].'-' . $row['categoryPerm'] . '.html">'. $row['categoryName'] . '</a><br />';
}
}
function makePermalink ( $i )
{
$url = ereg_replace('[^A-Za-z0-9]', ' ', $i);
$url = preg_replace('/\s\s+/', ' ', $url);
$url = str_replace(' ', '_', $url);
$url = trim_end_thing($url);
$url = strtolower($url);
return $url;
}
function trim_end_thing ($text)
{
if ( $text{strlen($text) -1} == "_" )
{
$text = substr_replace($text, "", strlen($text) -1);
}
return $text;
}
but it keeps giving me the error Fatal error: Call to undefined function: getcategories() in /home/layoutst/public_html/Graphics/index.php on line 14
hope this help clear it up.