Tkaspers88 Posted July 16, 2006 Share Posted July 16, 2006 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=amazonIm 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 CreaturesThis 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~ Link to comment https://forums.phpfreaks.com/topic/14777-phpdatabase-white-page-cant-find-my-error/ Share on other sites More sharing options...
redarrow Posted July 16, 2006 Share Posted July 16, 2006 <?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";}?> Link to comment https://forums.phpfreaks.com/topic/14777-phpdatabase-white-page-cant-find-my-error/#findComment-59003 Share on other sites More sharing options...
Drumminxx Posted July 16, 2006 Share Posted July 16, 2006 $ScreenAdress $row['ScreenAdress']; Missing = Link to comment https://forums.phpfreaks.com/topic/14777-phpdatabase-white-page-cant-find-my-error/#findComment-59006 Share on other sites More sharing options...
Tkaspers88 Posted July 17, 2006 Author Share Posted July 17, 2006 Ah.. thanks redarrow :)It works now.. I changed my <?php into <?php session_start();and it works :).. ThanksGreetings,Tkaspers Link to comment https://forums.phpfreaks.com/topic/14777-phpdatabase-white-page-cant-find-my-error/#findComment-59219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.