Jump to content

Recommended Posts

Greetings,

I have a website about an online game.. the game has 130 creatures and I made a database for the creatures.. that stores all the information about them..

I have a file called creature.php that should read all the information from the database and it should show it with an url like this: www.mysite.com/creature.php?xd=amazon



Im using the following code:

[code]<?php
$host = 'localhost';
$username = 'xxxxxxxxx';
$password = 'xxxxxxxxx';
$db = 'xxxxxxxxx';

$server = mysql_connect($host, $username, $password);

mysql_select_db($db);

$sql = "SELECT * FROM Creatures WHERE NameUrl = '".$_GET['xd']."'";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0)
{
    while($row = mysql_fetch_assoc($result))
    {
        $ImageAdress = $row['ImageAdress'];
        $Name = $row['Name'];
$Description = $row['Description'];
$Experience = $row['Experience'];
$Hitpoints = $row['Hitpoints'];
$Summon = $row['Summon'];
$Convince = $row['Convince'];
$Attacks = $row['Attacks'];
$Immunities = $row['Immunities'];
$Specials = $row['Specials'];
$Loot = $row['Loot'];
$Yell = $row['Yell'];
$XDComment = $row['XDComment'];
$ScreenAdress $row['ScreenAdress'];
    }
}
else
{
      header('Location: http://www.tibiaxd.net/preview/items/creaturesoverview.php');
}
?>[/code]

NameUrl is the name of the creature without capitals or spaces.. (amazon here)
My table is called Creatures

This is an example of my database:
[img]http://img145.imageshack.us/img145/4430/databasebi3.jpg[/img]


Im getting the information on its place by adding :  <?php echo ("$Name"); ?>  etc..

I think this all is correct.. but still, when I go to www.mysite.com/creature.php?xd=amazon, all I see is a white page.. >.<'


Someone see's the error? I cant find it..

Thanks in advance,
Tkaspers~
<?php session_start();

if($_GET['id']=="amazon") {

$host = 'localhost';
$username = 'xxxxxxxxx';
$password = 'xxxxxxxxx';
$db = 'xxxxxxxxx';

$server = mysql_connect($host, $username, $password);

mysql_select_db($db);

$sql = "SELECT * FROM Creatures WHERE NameUrl = '".$_GET['xd']."'";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0)
{
     while($row = mysql_fetch_assoc($result))
     {
         $ImageAdress = $row['ImageAdress'];
         $Name = $row['Name'];
$Description = $row['Description'];
$Experience = $row['Experience'];
$Hitpoints = $row['Hitpoints'];
$Summon = $row['Summon'];
$Convince = $row['Convince'];
$Attacks = $row['Attacks'];
$Immunities = $row['Immunities'];
$Specials = $row['Specials'];
$Loot = $row['Loot'];
$Yell = $row['Yell'];
$XDComment = $row['XDComment'];
$ScreenAdress = $row['ScreenAdress'];
     }
}
else
{
       header('Location: http://www.tibiaxd.net/preview/items/creaturesoverview.php');
}
}else{

echo"sorry no result";
}
?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.