This is just something that I'm working on for my own website. Could someone please check this over real quick to see if I have any major errors in it?

<?php
/* 
	index.php
	created by Suetan
	Start Date: Wednesday January 9, 2008
	Project: RPGCMS
	Version: 0.0.1a
*/

define('IN_RPGCMS', true);
$root = './../';
include($root . 'functions.' .$phpEx);
include($root . '/includes/common.' .$phpEx);

echo('<html>
<head>
	<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
	<title>Final Fantasy Heaven</title>
	<meta name="title" content="Final Fantasy Heaven" />
	<meta name="description" content="Only the best game information on the web" />
	<meta name="keywords" content="Final Fantasy, FF, Final Fantasy II, Final Fantasy 2, FF2, Final Fantasy III, Final Fantasy 3, FF3, Final Fantasy IV, Final Fantasy V, Final Fantasy 5, FF5, Final Fantasy VI, Final Fantasy 6, FF6, Final Fantasy VII, Final Fantasy 7, FF7, Final Fantasy VIII, Final Fantasy 8, FF8, Final Fantasy IX, Final Fantasy 9, FF9, Final Fantasy X, Final Fantasy 10, FF10, Final Fantasy XI, Final Fantasy 11, FF11, Final Fantasy XII, Final Fantasy 12, FF12, Final Fantasy Crystal Chronicles, FFCC, Final Fantasy Tactics, FFT, Final Fantasy Movies, FF Movies" /> 
	<meta name="author" content="Suetan" />
	<link rel="icon" href="images/favicon.ico" />
	<link rel="stylesheet" type="text/css" href="style.css" />
	<bgsound src="#" id="soundeffect" autostart="false" />
	<script type="text/javascript">
	var soundfile="sounds/menu.wav"
	function playsound(soundfile){
		if (document.all && document.getElementById){
		document.getElementById("soundeffect").src="" 
		document.getElementById("soundeffect").src=soundfile
		}
	}

	function bindsound(tag, soundfile, masterElement){
		if (!window.event) return
		var source=event.srcElement
		while (source!=masterElement && source.tagName!="HTML"){
			if (source.tagName==tag.toUpperCase()){
				playsound(soundfile)
				break
			}
		source=source.parentElement
		}
	}

	</script>
</head>
</head>
<body>
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="90%" align="center" class="logo"><img src="images/logo.gif" alt="" border="0"></td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>'
);

$sql = "SELECT 'w.welcome_title'
	FROM ' . WELCOME_TABLE . ' w";
	$result = mysql_query($sql);
$message_title = $result;
$sql2 = "SELECT 'w.welcome_text'
	FROM ' . WELCOME_TABLE . ' w";
	$result_text = mysql_query($sql2);
$message_text = $result_text;

echo('<table width="90%" cellspacing="0" cellpadding="0" border="0" align="left">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="100%" align="center">');
echo($message_title);
echo('</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>');
echo('<table width="90%" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="100%" align="center">');
echo($message_text);
echo('</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>');
	

// get the latest site news
$i = "0";
while ($i <= 5)
{
	$sql = "SELECT * FROM ' . NEWS_TABLE . ' n
		WHERE n.news_title = $news_title
		AND n.news_id = $news_id
		AND n.news_date = $news_date
		ORDER BY $news_date desc'";
	$result = mysql_query($sql);
	$title = $result->n.news_title;
	$text = $result->n.news_text;

echo('<table width="90%" cellspacing="0" cellpadding="0" border="0" align="left">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="100%" align="center">');
echo($title);
echo('</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
	<br />
	<table width="90%" cellspacing="0" cellpadding="0" border="0" align="left">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="100%" align="center">');
echo($text);
echo('</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
	<br />');
$i++;
}

// main menu and site stats
mainmenu();

$sql = 'SELECT COUNT(game_id) FROM ' . GAMES_TABLE . '';
$result = mysql_query->($sql);
echo('<table width="10%" align="right" valign="top" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td>We have detailed information on');
echo($result);
echo('games.</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
</body>
</html>');
?>

Recommended Answers

All 11 Replies

I had just a very quick glance but the php looks ok except i believe it would speed your script up if you didnt echo the html as it isnt needed

commented: Good advice for optimizing page load times in PHP, thanks Auzzie +1

Line 179. $result = mysql_query->($sql); should be $result = mysql_query($sql); :)

commented: Good advice for debugging PHP script... thanks Nav33n +1

Ok, thanks for the help with index.php. I've changed that so that the HTML isn't echoed, and the mysql_guery() was correct.

I'm starting on functions.php, and here's what I have so far.

::NOTE::
Sorry for having you guys debug this for me, I'm the only one that's working on this project, and I know that sometimes when you debug your own code, you read what you want to read and may miss some parts that will cause errors. Thanks for all your help.
::END NOTE::

<?php
/*
	functions.php
	created by Suetan
	Start Date: Tuesday February 26, 2008
	Project: RPGCMS
	Version: 0.0.1a
*/

define('IN_RPGCMS', true);
$root = './../';

function(mainmenu)
{
?>
<table width="10%" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
		<td class="topborder" width="100%"></td>
		<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
	</tr>
	<tr>
		<td class="leftborder" width="1%"></td>
		<td>
<?php
		$sql = "SELECT game_id, game_name, game_img FROM GAMES_TABLE 
			ORDER BY game_name ASC";
		$result = mysql_query($sql);
		$game = $mysql_fetch_result($result);
		while ($game_id)
		{
			echo('<a href="games.php?game_id='.$game->game_id.'"><img src="'.$game->game_img'" alt="'.$game->game_name.'"></a><br /><br />');
		}
?>
		</td>
		<td class="rightborder" width="1%"></td>
	</tr>
	<tr>
		<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
		<td class="bottomborder" width="100%"></td>
		<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
	</tr>
</table>
<?php
}

function(getmonsterinfo)
{
	$sql = "SELECT m.*
		FROM ' . MONSTERS_TABLE . ' m
		WHERE m.game_id = $game_id
		ORDER BY m.monster_location, m.monster_name desc";
	$result = mysql_query($sql);
	$monster = $mysql_fetch_result($result);
	if(empty($result))
	{
		echo('We currently do not have any monsters for this game yet. Please try again at a later time.');
	}
	else
	{
		while($monster[monster_id])
		{
	?>
			<table width="100%" cellpadding="2" cellspacing="2" border="2">
				<tr>
					<td width="25%"><?php echo('<img src="'.$monster['monster_img']'" alt="'.$monster_name'">'); ?></td>
					<td width="75%">
						<table width="100%" cellpadding="0" cellspacing="2" border="1">
							<tr>
								<td><?php echo($monster['monster_name']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_hp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_mp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_absorb']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_strong']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_weak']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_strength']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_magic']); ?></td>
							<tr>
								<td><?php echo($monster['monster_magic_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_speed']); ?></td>
							</tr>
						</table>
					</td>
				</tr>
			<?php
			if($monster['monster_type'] = "boss"
			{
			?>
				<tr>
					<td><?php echo($monster['monster_defeat_strat']); ?></td>
				</tr>
			<?php
			}
			?>
			</table>
			<?php
		}
	}
}

Use while($monster['monster_id']) instead of while($monster[monster_id]) .

And something is wrong with this line.

<td width="25%"><?php echo '<img src="'.$monster" alt=".$monster_name.">; ?></td>

I found what you're talking out.

Corrected:

line #66 from

<td width="25%"><?php echo('<img src="'.$monster['monster_img']'" alt="'.$monster_name'">'); ?></td>

to

<td width="25%"><?php echo('<img src="'.$monster['monster_img']'" alt="'.$monster['monster_name']'">'); ?></td>

Yep! and also replace while($monster[monster_id]) with while($monster['monster_id'])

Sorry to bring this back on you guys. I've got some more code that I need to be double checked. I'm hoping that I've done everything right... please note that I'm going to have just about everything done through functions (including the templating), and the actual files that will call them will be rather small.

Here's the code that I need checked:

<?php
/*
	functions.php
	created by Suetan
	Start Date: Tuesday February 26, 2008
	Project: RPGCMS
	Version: 0.0.2a
*/
if(!defined('IN_RPGCMS'))
{
	die("Hacking Attempt");
}

// for all pages
function(getcss)
{
?>
	<link rel="stylesheet" type="text/css" href="style.css">
<?php
}

// for all pages except index
function(overallheader)
{
?>
	<html>
		<head>
			<?php getcss(); ?>
		</head>
		<body>
<?php
}

function(overallfooter)
{
?>
		</body>
	</html>
<?php
}

// for index.php which now has an iframe for user friendlyness
function(indexheader)
{
	$sql = "SELECT 'site_name, meta_keywords, meta_desc' FROM ' . CONFIG_TABLE . '";
	$result = mysql_query($sql);
?>
<html>
<head>
	<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
	<title><?php echo($result['site_name']); ?></title>
	<meta name="title" content="<?php echo($result['site_name']); ?>">
	<meta name="description" content="<?php echo($result['meta_desc']); ?>">
	<meta name="keywords" content="<?php echo($result['meta_keywords']); ?>"> 
	<meta name="author" content="Suetan">
	<link rel="icon" href="images/favicon.ico">
	<?php getcss(); ?>
	<bgsound src="#" id="soundeffect" autostart="false">
	<script type="text/javascript" language="text/javascript">
	var soundfile="sounds/menu.wav"
	function playsound(soundfile){
		if (document.all && document.getElementById){
		document.getElementById("soundeffect").src="" 
		document.getElementById("soundeffect").src=soundfile
		}
	}

	function bindsound(tag, soundfile, masterElement){
		if (!window.event) return
		var source=event.srcElement
		while (source!=masterElement && source.tagName!="HTML"){
			if (source.tagName==tag.toUpperCase()){
				playsound(soundfile)
				break
			}
		source=source.parentElement
		}
	}
	</script>
</head>
<body>
	<table width="100%" cellspacing="0" cellpadding="0" border="0" valign="top">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td width="100%" align="center" class="logo"><img src="images/logo.gif" alt="" border="0"></td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
	<br>
<?php
}

function(indexbody)
{
?>
	<table width="90%" cellspacing="0" cellpadding="0" border="0" align="left" valign="top">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td><iframe width="100%" name="content" src="news. <?php echo($phpEx); ?>" height="85%"></iframe></td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
<?php
}

function(mainmenu)
{
?>
<table width="10%" cellspacing="0" cellpadding="0" border="0" align="right" valign="top">
	<tr>
		<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
		<td class="topborder" width="100%"></td>
		<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
	</tr>
	<tr>
		<td class="leftborder" width="1%"></td>
		<td><?php echo('<a href="news.'.$phpEx.'" target="content"><img src="images/index.gif"></a><br><br>
		<a href="games.'.$phpEx.'" target="content"><img src="images/games.gif"></a><br><br>
		<a href="characters.'$phpEx.'" target="content"><img src="images/characters.gif"></a><br><br>
		<a href="bestiary.'.$phpEx.'" target="content"><img src="images/bestiary.gif"></a><br><br>
		<a href="items.'.$phpEx.'" target="content"><img src="images/items.gif"></a><br><br>
		<a href="magic.'.$phpEx.'" target="content"><img src="images/magic.gif"></a><br><br>
		<a href="species.'.$phpEx.'" target="content"><img src="images/species.gif"></a><br><br>
		<a href="guides.'.$phpEx.'" target="content"><img src="images/guides.gif">'); ?></td>
		<td class="rightborder" width="1%"></td>
	</tr>
	<tr>
		<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
		<td class="bottomborder" width="100%"></td>
		<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
	</tr>
</table>
<br>
<?php
$sql = 'SELECT COUNT(game_id) FROM ' . GAMES_TABLE . '';
$result = mysql_query($sql);
?>
	<table width="10%" align="right" valign="top" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td><img src="images/nav_top_left_elbow.gif" alt=""></td>
			<td class="topborder" width="100%"></td>
			<td><img src="images/nav_top_right_elbow.gif" alt=""></td>
		</tr>
		<tr>
			<td class="leftborder" width="1%"></td>
			<td>We have detailed information on <?php echo($result); ?> games.</td>
			<td class="rightborder" width="1%"></td>
		</tr>
		<tr>
			<td><img src="images/nav_bottom_left_elbow.gif" alt=""></td>
			<td class="bottomborder" width="100%"></td>
			<td><img src="images/nav_bottom_right_elbow.gif" alt=""></td>
		</tr>
	</table>
	<br>
<?php
}

function(indexfooter)
{
?>
	<div align="center"><font size="-1">Powered by RPGCMS<br>All games used for content, the images used, and all likeliness are copyrights, or registered copyrights of their respective creators.</font></div>
</html>
<?php
}

// for bestiary
function(getmonsterinfo)
{
	$sql = "SELECT m.*
		FROM ' . MONSTERS_TABLE . ' m
		WHERE m.game_id = $game_id
		ORDER BY m.monster_location, m.monster_name ASC";
	$result = mysql_query($sql);
	$monster = $mysql_fetch_result($result);
	if(empty($result))
	{
		echo('We currently do not have any monsters for this game yet. Please try again at a later time.');
	}
	else
	{
		while($monster['monster_id'])
		{
	?>
			<table width="100%" cellpadding="2" cellspacing="2" border="2">
				<tr>
					<td width="25%"><?php echo('<img src="'.$monster['monster_img']'" alt="'.$monster['monster_name']'">'); ?></td>
					<td width="75%">
						<table width="100%" cellpadding="0" cellspacing="2" border="1">
							<tr>
								<td><?php echo($monster['monster_name']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_hp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_mp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_absorb']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_strong']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_element_weak']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_strength']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_magic']); ?></td>
							<tr>
								<td><?php echo($monster['monster_magic_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($monster['monster_speed']); ?></td>
							</tr>
						</table>
					</td>
				</tr>
			<?php
			if($monster['monster_type'] = "boss")
			{
			?>
				<tr>
					<td><?php echo($monster['monster_defeat_strat']); ?></td>
				</tr>
			<?php
			}
			?>
			</table>
			<br />
			<?php
		}
	}
}

// for magic list
function(getmagicinfo)
{
	$sql = "SELECT ma.*
		FROM ' . MAGIC_TABLE . ' ma
		WHERE ma.game_id = $game_id
		ORDER BY ma.magic_name ASC";
	$result = mysql_query($sql);
	$magic = $mysql_fetch_result($result);
	if(empty($result))
	{
		echo('We currently do not have any magic for this game yet. Please try again at a later time.');
	}
	else
	{
	?>
			<table width="100%" cellpadding="2" cellspacing="2" border="2">
	<?php
		while($magic['magic_id'])
		{
	?>
			
				<tr>
					<td><?php echo($magic['magic_name']); ?></td>
					<td><?php echo($magic['magic_mp']); ?></td>
				<?php
				if($magic['magic_type'] = "attack" && !empty($magic['magic_element']);
				{
				?>
					<td><?php echo($magic['magic_element']); ?></td>
				<?php
				}
				?>
					<td><?php echo($magic['magic_level']); ?></td>
					<td><?php echo($magic['magic_type']); ?></td>
				<?php if($magic['magic_type'] = "support" || $magic['magic_type'] = "status_attack")
				{
				?>
					<td><?php echo($magic['magic_effect']); ?></td>
				<?php
				}
				if($magic['magic_type'] = "summon")
				{
				?>
					<td><?php echo($magic['magic_attack_name']); ?></td>
					<td><?php echo($magic['magic_effect']); ?></td>
				<?php
				}
				?>
			</table>
			<br />
			<?php
		}
	}
}

// for item list
function(getiteminfo)
{
	$sql = "SELECT i.*
		FROM ' . ITEM_TABLE . ' i
		WHERE i.game_id = $game_id
		ORDER BY i.item_name ASC";
	$result = mysql_query($sql);
	$item = $mysql_fetch_result($result);
	
	if(empty($result))
	{
		echo('We currently do not have any items for this game yet. Please try again at a later time.');
	}
	else
	{
	?>
			<table width="100%" cellpadding="2" cellspacing="2" border="2">
	<?php
		while($item['item_id'])
		{
	?>
			
				<tr>
					<td><?php echo($item['item_name']); ?></td>
				<?php
				if($item['item_type'] = "weapon");
				{
				?>
					<td><?php echo($item['item_strength']); ?></td>
				<?php
				}
				elseif($item['item_type'] = "armor")
				{
				?>
					<td><?php echo($item['item_def']); ?></td>
				<?php if(!empty($item['item_mag_def']))
					{
				?>
					<td><?php echo($item['item_mag_def']); ?>
				<?php
					}
				}
				elseif($item['item_type'] = "accessory" && !empty($item['item_effect']))
				{
				?>
					<td><?php echo($item['item_effect'])?>
				<?php
				}
				else
				{
				?>
					<td><?php echo($item['item_effect']); ?></td>
					<?php if(!empty($item['item_heal']) 
					{ ?>
					<td><?php echo($item['item_heal']); ?></td>
					<?php }
					if(!empty($item['item_dmg'])
					{ ?>
					<td><?php echo($item['item_dmg']); ?></td>
					<?php }
				}
				?>	
				</tr>
				<?php
		}
		?>
		</table>
		<br />
	<?php
	}
}

// for character info
function(getcharacterinfo)
{
	$sql = "SELECT c.*
		FROM ' . CHARACTER_TABLE . ' c
		WHERE c.game_id = $game_id
		ORDER BY c.character_name ASC";
	$result = mysql_query($sql);
	$char = $mysql_fetch_result($result);
	
	if(empty($result))
	{
		echo('We currently do not have any characters for this game yet. Please try again at a later time.');
	}
	else
	{
	?>
			<table width="100%" cellpadding="2" cellspacing="2" border="2">
	<?php
		while($char['char_id'])
		{
	?>
				<table width="100%" cellpadding="2" cellspacing="2" border="2">
				<tr>
					<td width="25%"><?php echo('<img src="'.$char['char_img']'" alt="'.$char['char_name']'">'); ?></td>
					<td width="75%">
						<table width="100%" cellpadding="0" cellspacing="2" border="1">
							<tr>
								<td><?php echo($char['char_name']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_hp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_mp']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_strength']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_magic']); ?></td>
							<tr>
								<td><?php echo($char['char_start_magic_def']); ?></td>
							</tr>
							<tr>
								<td><?php echo($char['char_start_speed']); ?></td>
							</tr>
							<?php
							if (!empty($char['char_limit_break']) && !empty($char['char_limit_break_desc']))
							{
								while($char['char_limit_break'])
								{
								?>
									<tr>
										<td><?php echo($char['char_limit_break']) ?></td>
									</tr>
									<tr>
										<td><?php echo($char['char_limit_break_desc']) ?></td>
									</tr>
									<?php
									if(!empty($char['char_limit_img']))
									{
									?>
										<tr>
											<td><img src="<?php echo($char['char_limit_img']); ?>" alt="<?php echo($char['char_limit_break']); ?>"></td>
										</tr>
									<?php
									}
								}
							}
							?>
						</table>
					</td>
				</tr>
			<?php
		}
	}
}

function(getgamelist)
{
	$sql = "SELECT g.* 
		FROM ' . GAMES_TABLE . ' g
		ORDER BY g.game_name ASC";
	$result = mysql_query($sql);
	$td = 0;
?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
<?php
	while($result['game_id'])
	{
		while($td > 2)
		{
?>
			<td width="50%" align="center"><a href="games.<?php echo($phpEx); ?>"?mode="displaygame"&game_id="<?php echo($result['game_id']); ?>"><img src="<?php echo($result['game_title_img']); ?>" border="0" alt="<?php echo($result['game_name']); ?>"></a></td>
<?php
			$td++
			if($td == 2)
			{
?>		
				</tr>
				<tr>
<?php
				$td = 0;
			}
		}
	}
}

First off the way to declare functions are like this:

function functionName($paramter1, $parameter2, $etc)

Not

function (functionName)

on line 45:

$sql = "SELECT 'site_name, meta_keywords, meta_desc' FROM ' . CONFIG_TABLE . '";

needs to be replaced with:

$sql = "SELECT 'site_name, meta_keywords, meta_desc' FROM '" . CONFIG_TABLE . "'";

On line 139:

<a href="characters.'$phpEx.'" target="content"><img src="images/characters.gif"></a><br><br>

Needs to be replaced with

<a href="characters.'.$phpEx.'" target="content"><img src="images/characters.gif"></a><br><br>

On Line 155:

$sql = 'SELECT COUNT(game_id) FROM ' . GAMES_TABLE . '';

Needs to be replaced with:

$sql = 'SELECT COUNT(game_id) FROM ' . GAMES_TABLE;

Lines 190-193:

$sql = "SELECT m.*
		FROM " . MONSTERS_TABLE . " m
		WHERE m.game_id = $game_id
		ORDER BY m.monster_location, m.monster_name ASC";

On line 195:

$monster = $mysql_fetch_result($result);

Has a problem because mysql_fetch_result isnt a valid function, maybe mysql_fetch_field is what you are after?

On line 246:

if($monster['monster_type'] = "boss")

Unless you want the monster to always be a boss needs to be replaced with:

if($monster['monster_type'] == "boss")

On lines 265-268:

$sql = "SELECT ma.*		
                FROM ' . MAGIC_TABLE . ' ma
		WHERE ma.game_id = $game_id
		ORDER BY ma.magic_name ASC";

Needs to be repllaced with:

$sql = "SELECT ma.*		
                FROM " . MAGIC_TABLE . " ma
		WHERE ma.game_id = $game_id
		ORDER BY ma.magic_name ASC";

On line 270:

$magic = $mysql_fetch_result($result);

Has the same problem as mentioned further up

On line 288:

if($magic['magic_type'] = "attack" && !empty($magic['magic_element']);

Needs to be replaced with:

if($magic['magic_type'] == "attack" && !empty($magic['magic_element']);

On line 297:

<?php if($magic['magic_type'] = "support" || $magic['magic_type'] = "status_attack")

Needs replacing with

<?php if($magic['magic_type'] == "support" || $magic['magic_type'] == "status_attack")

On line 303:

if($magic['magic_type'] = "summon")

Needs replacing with

if($magic['magic_type'] == "summon")

On lines 321-324:

$sql = "SELECT i.*
		FROM ' . ITEM_TABLE . ' i
		WHERE i.game_id = $game_id
		ORDER BY i.item_name ASC";

Needs replacing with:

$sql = "SELECT i.*
 	FROM "' . ITEM_TABLE . '" i
		WHERE i.game_id = $game_id
		ORDER BY i.item_name ASC";

On line 326:

$item = $mysql_fetch_result($result);

Has the same problem as above

On lines 394-397:

$sql = "SELECT c.*
		FROM ' . CHARACTER_TABLE . ' c
		WHERE c.game_id = $game_id
		ORDER BY c.character_name ASC";

Needs replacing with:

$sql = "SELECT c.*
		FROM "' . CHARACTER_TABLE . '" c
		WHERE c.game_id = $game_id
		ORDER BY c.character_name ASC";

On lines 475-477:

$sql = "SELECT g.*
 		FROM ' . GAMES_TABLE . ' g
		ORDER BY g.game_name ASC";

Needs replacing with:

$sql = "SELECT g.*
 		FROM "' . GAMES_TABLE . '" g
		ORDER BY g.game_name ASC";

If i have missed summat i apologise but its like 7am and i just got back from work

commented: :) +5

Hey, no problem. I'm just doing this in my free time. It's my first time tackeling something this big on my own. I could use a partner to help me out in their spare time if anyone's willing. If not, then that's okay too.

It's about 3:00AM (on Friday) where I am, and I'm about to go to sleep. I'll make the changes when I get up.

Thanks Auzzie

*Adds Auzzie and Nav33n to contact list*

Lol no worries but yea if you want a hand with it just give me a shout (my msn is in my profile) just use that email address. I will give it another look later on when i have slept but nav33n proberbly would have done it by then :P

Yeah, or we can just email back and forth. My email's takarne124@live.com. That way we're not struggling to catch each other online at the same time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.