Bradley99 Posted January 27, 2011 Share Posted January 27, 2011 Hi ho, I am trying to assemble a table so that it shows article in order by id descending. The current one i am using is working but not displaying as i hoped, i need them aligned on the left and right, so id=1 align left, id=2 align right etc. Here's my current code <table style='table-layout:fixed' align="center" cellpadding="2" cellspacing="0" colspan="" class="Main"><br> <? $select_paper=mysql_query("SELECT * FROM paper ORDER BY id DESC"); while($the=mysql_fetch_object($select_paper)){ ?> <tr> <td class="subtableheader" width="25%"><?php echo "$the->title"; ?></td> </tr> <tr> <td class="profilerow" width="100%"><?php echo "$the->news"; ?></td> </tr> <tr> <td class="subtableheader" width="25%"><?php echo "Article By $the->by - $the->date"; ?></td> </tr> Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/ Share on other sites More sharing options...
spaceman12 Posted January 27, 2011 Share Posted January 27, 2011 Hope that fixed your problem. <table style='table-layout:fixed' align="center" cellpadding="2" cellspacing="0" colspan="" class="Main"><br> <? $select_paper=mysql_query("SELECT * FROM paper ORDER BY id DESC"); while($the=mysql_fetch_object($select_paper)){ ?> <tr> <td class="subtableheader" width="25%"><?php echo "$the->title"; ?></td><td class="profilerow" width="100%"><?php echo "$the->news"; ?></td> </tr> <tr> <td class="subtableheader" width="25%"><?php echo "Article By $the->by - $the->date"; ?></td> </tr> Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/#findComment-1165996 Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Author Share Posted January 27, 2011 I'm afraid it didn't. I need the full table aligning not just the news part. So... [Article1] [Article2] [Article3] [Article4] ? Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/#findComment-1165999 Share on other sites More sharing options...
spaceman12 Posted January 27, 2011 Share Posted January 27, 2011 Perhaps, if you can make a rough sketch of how you want to make your output look like, i can surely help you. Cause, I'm not fully understanding by what you actually meant Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/#findComment-1166001 Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Author Share Posted January 27, 2011 Like so [This table would be news id=1] [This table would be news id=2] So 1 is aligned to the left and 2 is aligned to the right? Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/#findComment-1166002 Share on other sites More sharing options...
BlueSkyIS Posted January 27, 2011 Share Posted January 27, 2011 this is more of a HTML question. i suggest that you first build the HTML the way you want it to look, then insert the PHP to echo the values. Link to comment https://forums.phpfreaks.com/topic/225857-select-from-order-by-id-tables/#findComment-1166011 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.