Jump to content

Tkaspers88

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Tkaspers88's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [quote author=ronverdonk link=topic=102709.msg408058#msg408058 date=1154526993] Something like this perhaps? [code]    $i=1;   while($row = mysql_fetch_assoc($result))     {   if ($i == 1)         echo '<tr>';         echo   '<TD><A HREF="creature.php?xd='.$row['NameUrl'].'"><IMG border=0 src="images/'.$row['ImageAdress'].'" width=64 height=64> </A><BR><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC"><strong>'.$row['Name'].'</strong></font> <br /><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#999999"><em>Exp: '.$row['Experience'].'</em></font> <br /><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><em>HP: '.$row['Hitpoints'].'</em></font></TD>';     if ($i == 5)     echo '</tr>';   $i++;       }     if ($i != 1 && $i != 5)       echo '</tr>';     echo '</table>';[/code] Ronald  ;D [/quote] It works "almost".. It works for the first 5 creatures.. but all the others are next to each other.. hmm Greetings, Thijs
  2. I have a database with information about MMORPG monsters.. now I want to create a creatureoverview like you can see here: [url=http://www.tibia.com/library/?subtopic=creatures]http://www.tibia.com/library/?subtopic=creatures[/url] and here [url=http://www.tibianews.net/bestiary.asp]http://www.tibianews.net/bestiary.asp[/url] etc.. I want to show 5 creatures on a row.. I use this code to get the information from the database and to show them: [code]<?php include('../dbconfig.php'); $sql = "SELECT ImageAdress,NameUrl,Name,Experience,Hitpoints FROM Creatures ORDER BY Name"; if(!$result = mysql_query($sql)) {   echo "Error: Creating creaturelist failed. Please try again!"; } else {   if(mysql_num_rows($result) == 0)   {     echo "Error: No results.. Please try again!";   }   else   {     while($row = mysql_fetch_assoc($result))     {       echo     '<TD><A HREF="creature.php?xd='.$row['NameUrl'].'"><IMG border=0 src="images/'.$row['ImageAdress'].'" width=64 height=64> </A><BR><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC"><strong>'.$row['Name'].'</strong></font> <br /><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#999999"><em>Exp: '.$row['Experience'].'</em></font> <br /><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><em>HP: '.$row['Hitpoints'].'</em></font></TD>';         }   } } ?>[/code] But it shows them wrong... As you can see it shows the image,name,exp and hp and it retrieves all creatures from my database.. how can i make it like i want it? I want it to show 5 creatures next to each other and not all of them.. so it needs to start a new row after 5 creatures.. Maybe its modulo? //Thijs
  3. Ah.. thanks redarrow :) It works now.. I changed my    <?php    into    <?php session_start(); and it works :).. Thanks Greetings, Tkaspers
  4. 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~
×
×
  • 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.