Help - Search - Members - Calendar
Full Version: PHP Help
HTMLHelp Forums > Programming > Server-side Scripting
iyparadise
I need help. I am starting up a tcg and I want a certain number of cards to be displayed in each row. Right now, there are 4 rows with 6 images and 1 row with 2 images. How can I alter the code below to to have just 5 rows, with 5 images in each? The script works fine, I just wanted to know how to limit the displayed number of images in each row.

Here is the PHP code I'm using now:

_________________________________________________

<?php include("../tcgadmin/config.php");
include($header);

$cld = CleanUp($_GET['d']);
$d = "$cld";

$fill="00";

$result=mysql_query("SELECT DISTINCT `deckfilename`, `deckname`, `descrip`,

`totalcards`, `cardvalue`, `masterable`, `category`, `cardwidth`, `cardheight` FROM

`$tablename2` WHERE `deckfilename`='$d'") or die("Unable to select database.");
$row=mysql_fetch_array($result);
$row[deckname] = stripslashes($row[deckname]);
$row[descrip] = stripslashes($row[descrip]);

echo "<div class=\"title\">Cards - $row[deckname]</div><p></p>";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\"

valign=\"top\"><img

src=\"$cardsurl/$row[category]/$row[deckfilename]/$row[deckfilename]$fill.gif\"

border=\"0\" width=\"$row[cardwidth]\" height=\"$row[cardheight]\"

alt=\"$row[deckname] Filler\" /> <img

src=\"$cardsurl/$row[category]/$row[deckfilename]/mastered.gif\" border=\"0\"

width=\"$row[cardwidth]\" height=\"$row[cardheight]\" alt=\"$row[deckname] Mastered

Card\" /></td><td width=\"4\"></td><td align=\"left\"

valign=\"top\"><p><b>Description:</b> <i>$row[descrip]</i><br />
<b>Cards in Deck:</b> $row[totalcards]<br />
<b>Value per Card:</b> $row[cardvalue]<br />
<b>Masterable?</b> $row[masterable]</p></td></tr></table>";
echo "<p style=\"text-align:left\">";
$result2=mysql_query("SELECT * FROM $tablename2 WHERE deckfilename='$d'

ORDER BY id ASC") or die(mysql_error());
while($row2=mysql_fetch_array($result2)) { echo "<img

src=\"$cardsurl/$row2[category]/$row2[deckfilename]/$row2[deckfilename]$row2[car

dnum].gif\" border=\"0\" alt=\"$row2[deckfilename]$row2[cardnum] card\" /> "; }
echo "</p>
<p>REMEMBER: You may NOT take cards from here to add to your TCG page.

<b>THESE ARE FOR VIEWING PURPOSES ONLY!</b></p><p><a

href=\"index.php\">Back</a>";

include($footer); ?>

_________________________________________________

Thanks!!
Brian Chandler
QUOTE
I need help. I am starting up a tcg and I want a certain number of cards to be displayed in each row. Right now, there are 4 rows with 6 images and 1 row with 2 images. How can I alter the code below to to have just 5 rows, with 5 images in each? The script works fine, I just wanted to know how to limit the displayed number of images in each row.


There's no simple way to "limit the displayed number ...in each row". You have a program, you need a different program - either get the person who wrote it to write it for you, or pay someone to do it, or learn to write it yourself. The program isn't exactly very clearly written, so rewriting it will be a considerable fiddle.

OTOH, it seems to be writing a sequence of images, so if you just fixed the width of the table they are sitting in, you might get the right effect.
iyparadise
I was afraid of that. Well, thanks anyway! =D
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.