yuws Posted May 22, 2008 Share Posted May 22, 2008 I need help by getting this content to go in rows of 3 horizontal. right now it lines up strait down. Here's the code: <?php include 'functions.php'; ?> <?php connect(); $id = mysql_escape_string(intval($_GET['id'])); $query = "SELECT * FROM `users` WHERE `id` = '$id'"; $result = mysql_query($query); $numrows = @mysql_num_rows($result); if ($numrows != 0) { $row = mysql_fetch_array($result); $name = stripslashes($row['username']); $query = "SELECT * FROM favorites WHERE uid='$id'"; $result = mysql_query($query); $numrows = @mysql_num_rows($result); ?> <table border="0" cellpadding="0" cellspacing="0" width="742px" class="side"> <tr> <td class="btitle" valign="top" colspan="2"><?php echo $name; ?>'s Favorites</td> </tr> <tr> <td align="left" valign="top"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <?php if ($numrows != 0) { $dl = "celll"; $i = 0; while ($row = mysql_fetch_array($result)) { $game_id = stripslashes($row['gameid']); $q = "SELECT `name`, `description`, `image`, `display` FROM `ava_games` WHERE `id` = '$game_id'"; $r = mysql_query($q); $rw = mysql_fetch_assoc($r); $gt = stripslashes($rw['name']); $ds = stripslashes($rw['description']); $im = stripslashes($rw['image']); $display = stripslashes($rw['display']); $i++; if ($i % 2 == 0) { $dl = "celll"; } else { $dl = "celld"; } if ($display) { ?> <tr> <td width="35" height="35" bgcolor="ffffff" class="text"><? echo '<img src="<?php echo $im;?>" alt="" width="90" height="90" />';?> <font color="#333333"><b> <a href="game.php?id=<?php echo $game_id; ?>" class="dlink"><?php echo $gt; ?></a> </b></font></td> <?php } } } else { ?> <tr> <td align="center" class="content"> <br><?php echo itou($id) . " has no favorites yet."; ?> </td> </tr> <?php } ?> </table> </td> </tr> </table> <?php } else { message("User not found. Please check the link and try again."); } mysql_close(); ?> <?php ?> if anyone could help me fix this, that would be awsome! Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 Anyone know how? Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Quote Link to comment Share on other sites More sharing options...
revraz Posted May 22, 2008 Share Posted May 22, 2008 Check the FAQ forums, there is a guide there. Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 guide for what? Quote Link to comment Share on other sites More sharing options...
revraz Posted May 22, 2008 Share Posted May 22, 2008 For what you asked for I need help by getting this content to go in rows of 3 horizontal. guide for what? Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 FAQ/Code Snippet Repository? ive checked there but i didn't see anything that would help, if you did see anything mind posting link? Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted May 22, 2008 Share Posted May 22, 2008 youve set vertical alignment (valign) for ur table. Also you have valign your <td> tag which will align your variables inside that tag vertically Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 so (halign) would work? and take out <td>? Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted May 22, 2008 Share Posted May 22, 2008 leave your <td> tag and just remove your valign from it. Should default to horizontal. Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted May 22, 2008 Share Posted May 22, 2008 that might not be the cause, ill have a look soon for you Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 yea it didn't work. Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 taking out valign didn't make anydifference. Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted May 22, 2008 Share Posted May 22, 2008 I just copyed your html table, all writing comes out horizontal. So your table is fine Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted May 22, 2008 Share Posted May 22, 2008 How are you wanting it? you want 3 colomns and 1 row? Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 yea i want it to show a max of 9 games, but 3 in each row. Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 also grayfox i sent you a pm. Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 anyone else know how to make it work? Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bumpppp Quote Link to comment Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 anyone out there gonna help? Quote Link to comment Share on other sites More sharing options...
Pioden Posted May 22, 2008 Share Posted May 22, 2008 Hi, So you want a table with three columns? OK if I understood properly it works like this. You need to code a little counter for your output. When $count > 3 it resets and starts a new row. <table > <tr> <td>1</td> <td>2</td> <td>3</td> </tr> </table> Start you loop with <tr> Put the results in <td>'s When the result counter gets to 4 it echo's </tr> and starts the process again. That's the way it works anyway. I coded this once but I don't remember in which file the code lives! The only 'hard' bit if adding the extra empty <td>'s if you have an inconvenient number of results e.g. if you have 10 results you'll need to add two <td> sets to finish the table in a tidy way. HTH Huw Quote Link to comment Share on other sites More sharing options...
yuws Posted May 23, 2008 Author Share Posted May 23, 2008 Can anyone explain how to make it go horizontal? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.