...

View Full Version : Character Bios Page



ParadoxKing
11-02-2009, 05:09 PM
I didn't know if this belonged with MySQL or PHP but... here's the deal, I have had a website for some time now and it has been through many changes. For example, I formatted my entire site to fit the same template. While working on converting old pages to the new template I noticed some errors that weren't there originally there.

The biggest one and the only one I have been unable to fix is the Character Bios Page for my animation series.

The Bios Index is completely functional, here is the code:

charbios.php

<div id='biostable'>
<ul class='style'>
<?php
$user="root";
$password="k66t6M9";
$database="bios";
mysql_connect("127.0.0.1",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM biospg";
$result=mysql_query($query);
while ($row=mysql_fetch_array($result)) {
echo sprintf ("<li class='style2'><a href='char2.php?id={$row["ID"]}'>{$row["name"]}</a></li>");
}
?>
</ul>
</div>


This page (http://www.k66t6-mf.com/paradox_god/charbios.php) is completely functional.

However, the actual character bios does not work as you see when you click any of the links in the character index. Here is the code for that page:

char.php

<?php
$user="root";
$password="k66t6M9";
$database="bios";
mysql_connect("127.0.0.1",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM biospg WHERE name='$name'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo sprintf ("<table cellspacing='0' cellpadding='3px' id='chartable' border='2'>\n");
echo sprintf ("<tr> \n");
echo sprintf ("<td class='name'>\n");
echo sprintf ("{$row["name"]}");
echo sprintf ("</td>\n");
echo sprintf ("</tr>\n");
echo sprintf ("<tr>\n");
echo sprintf ("<td class='desc'>\n");
echo sprintf ("{$row["description"]}\n");
echo sprintf ("</td>\n");
echo sprintf ("</tr>\n");
echo sprintf ("<tr>\n");
echo sprintf ("<td class='pict'>\n");
echo sprintf ("<center>\n");
echo sprintf ("<img src='{$row["image"]}' align='center' />\n");
echo sprintf ("</center>\n");
echo sprintf ("</td>\n");
echo sprintf ("</tr>\n");
echo sprintf ("</table>\n");
}
?>

As you can see if you follow the links the page appears empty. Does anyone know why the content is not showing up? Any help would be great. Thanks in advance.

met
11-02-2009, 05:44 PM
add



<?php
$user="root";
$password="k66t6M9"; /* lol */
$database="bios";
mysql_connect("127.0.0.1",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
/* --------------- */
$name=$_GET['id'];
$query="SELECT * FROM biospg WHERE name=".$name." LIMIT 1";
// snip


but you should validate $name first to prevent any kind of attempted hack. check its an integer etc.

Phil Jackson
11-02-2009, 06:14 PM
Mate, remove your db details.

ParadoxKing
11-03-2009, 05:09 AM
changing password... but about my problem (i usually get rid of that stuff)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum