Jump to content


Photo

PHP/Database.. White Page (Cant find my error)


  • Please log in to reply
3 replies to this topic

#1 Tkaspers88

Tkaspers88
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 July 2006 - 04:41 PM

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:

<?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');
}
?>

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:
Posted Image


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~

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 July 2006 - 04:47 PM

<?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.n...resoverview.php');
}
}else{

echo"sorry no result";
}
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 16 July 2006 - 04:56 PM

$ScreenAdress $row['ScreenAdress']; Missing =
:: gucci.com ::
:: blockbuster.com ::

--------------------

#4 Tkaspers88

Tkaspers88
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 July 2006 - 09:44 AM

Ah.. thanks redarrow :)

It works now.. I changed my    <?php    into    <?php session_start();
and it works :).. Thanks

Greetings,
Tkaspers




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users