miriamele Posted August 1, 2007 Share Posted August 1, 2007 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 More sharing options...
miriamele Posted August 2, 2007 Author Share Posted August 2, 2007 Bump Link to comment https://forums.phpfreaks.com/topic/62951-solved-phpmysql-db-retreival/#findComment-314068 Share on other sites More sharing options...
Usio Posted August 4, 2007 Share Posted August 4, 2007 im having the same problem as you with tcgadmin... T_T i was thinking that maybe adding a <p width="xxx"> would solve it? Link to comment https://forums.phpfreaks.com/topic/62951-solved-phpmysql-db-retreival/#findComment-315388 Share on other sites More sharing options...
Usio Posted August 4, 2007 Share Posted August 4, 2007 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 Link to comment https://forums.phpfreaks.com/topic/62951-solved-phpmysql-db-retreival/#findComment-315398 Share on other sites More sharing options...
miriamele Posted August 6, 2007 Author Share Posted August 6, 2007 Thank you sooooo much!! I was actually doing a 4x5 rather than a 5x4 thing so all I did was change the 4 to a 3 and it worked!! http://www.miriamele.com/openbook/cards/show.php?d=stone Thank you so much for your help! You are my hero! <3 Link to comment https://forums.phpfreaks.com/topic/62951-solved-phpmysql-db-retreival/#findComment-316873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.