Jump to content

Recommended Posts

Alright. I'm a very new person to PhP and MySQL. I have a feeling you all will simply tell me to bugger off and not bother with it, but here I am ; )

 

I am creating a site that needs to retrieve images from my db and arrange them in a table. I didn't actually create this code and unfortunately the person who created it is not supporting it. So here I am fending for myself. For more information, you can go to http://www.paraph.net/scripts/tcgadmin/index.php to see the actual original php files, etc.

 

So I have these image saved in a folder and the commands are supposed to retrieve them and post them. What it's doing is just listing all the images in a row. Do you know how to alter it to change it to a 5 column/4 row table? I've tried everything I can figure out on my own with absolutely no luck.

 

This is what I'm working with:

 

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

$fill="00";
$result=mysql_query("SELECT DISTINCT deckfilename, deckname, descrip, totalcards, cardvalue, masterable, category, cardwidth, 
cardheight FROM $tablename2 WHERE deckfilename='$d'") or die(mysql_error());
$row=mysql_fetch_array($result);
$row[deckname] = stripslashes($row[deckname]);
$row[descrip] = stripslashes($row[descrip]);
echo "<p><b>Cards - $row[deckname]</b></p>";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"top\" 
width=\"$row[cardwidth]\"><img src=\"$cardsurl/$row[category]/$row[deckfilename]/$row[deckfilename]$fill.gif\" border=\"0\" 
width=\"$row[cardwidth]\" height=\"$row[cardheight]\" alt=\"$row[deckname] Filler\" /></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[cardnum].gif\" border=\"0\" 
width=\"$row2[cardwidth]\" height=\"$row2[cardheight]\" 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>";

include($footer); ?>

 

And this is where you can view how it appears, in example: http://www.miriamele.com/openbook/cards/show.php?d=stone

Link to comment
https://forums.phpfreaks.com/topic/62951-solved-phpmysql-db-retreival/
Share on other sites

im having the same problem as you with tcgadmin... T_T i was thinking that maybe adding a <p width="xxx"> would solve it?

im sorry i dont know how to edit... but i found a solution!!! I was messing with my code and it happens that replacing:

 

while($row2=mysql_fetch_array($result2)) { echo "<img 
src=\"$cardsurl/$row2[category]/$row2[deckfilename]/$row2[deckfilename]$row2[cardnum].gif\" border=\"0\" 
width=\"$row2[cardwidth]\" height=\"$row2[cardheight]\" alt=\"$row2[deckfilename]$row2[cardnum] card\" /> "; }

 

with:

while($row2 = mysql_fetch_array($result2))
{
    $img  = "<img
src=\"$cardsurl/$row2[category]/$row2[deckfilename]/$row2[deckfilename]$row2[cardnum].gif\" border=\"0\"
width=\"$row2[cardwidth]\" height=\"$row2[cardheight]\" alt=\"$row2[deckfilename]$row2[cardnum] card\" />";


    echo $img;

    if($i == 4)
    {
        echo "<br />";
        $i = -1;
    }

    $i++;
}

 

seems to work! btw that code was originally from a member here.. you say that it got you division by zero but replacing the img url with the older one and adding a -1 seem to work ^^ (at least for me im using tcgadmin as a trade post x,x)  here you can see the results: http://tcg.silpelit.org/reminiscence/cards/show.php?d=prosthetic

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.