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! Link to comment https://forums.phpfreaks.com/topic/106694-help-please/ Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 Anyone know how? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546963 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546969 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. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546989 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 guide for what? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546992 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? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546994 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? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546996 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 Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-546997 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>? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547002 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. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547003 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 Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547008 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 yea it didn't work. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547011 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. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547019 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 Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547025 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? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547027 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. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547032 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. Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547039 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547048 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? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547056 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547078 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bump Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547098 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 bumpppp Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547138 Share on other sites More sharing options...
yuws Posted May 22, 2008 Author Share Posted May 22, 2008 anyone out there gonna help? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547168 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 Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547171 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? Link to comment https://forums.phpfreaks.com/topic/106694-help-please/#findComment-547916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.