UnknownPlayer Posted April 18, 2010 Share Posted April 18, 2010 I have problem with table in my page :S First problem with this code: <?php $query = "SELECT * FROM prijave ORDER BY date ASC"; $result = mysql_query($query, $connection); $i = 0; while ($prijava = mysql_fetch_array($result)) { $i++; if ($i % 2) { $bgcolor = "#EEEEEE"; } else { $bgcolor = "#E0E0E0"; } $date = $prijava['date']; $show_date = date("H:i:s m/d/Y", $date); echo ' <tr> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['ime'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['prezime'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['ispit'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$show_date.' </font> </td> </tr> '; } ?> .. there is a picture of this problem: And second option, i mean same thing but problem in tds :S <?php $query = "SELECT * FROM prijave ORDER BY date ASC"; $result = mysql_query($query, $connection); $i = 0; while ($prijava = mysql_fetch_array($result)) { $i++; if ($i % 2) { $bgcolor = "#EEEEEE"; } else { $bgcolor = "#E0E0E0"; } $date = $prijava['date']; $show_date = date("H:i:s m/d/Y", $date); echo ' <table border="1px" width="70%"> <tr> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['ime'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['prezime'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$prijava['ispit'].' </font> </td> <td width="1%" valign="top" nowrap bgcolor="'.$bgcolor.'"> <font face="Arial" size="2"> '.$show_date.' </font> </td> </tr> </table> '; } ?> Picture: Link to comment https://forums.phpfreaks.com/topic/198956-table-problem-s/ Share on other sites More sharing options...
andrewgauger Posted April 19, 2010 Share Posted April 19, 2010 2nd: put the <table> declarations outside the loop, that way you create 1 table and the | will line up. I don't know what is wrong with the 1st. Link to comment https://forums.phpfreaks.com/topic/198956-table-problem-s/#findComment-1044375 Share on other sites More sharing options...
-Karl- Posted April 19, 2010 Share Posted April 19, 2010 First one there's no <table> or </table> Link to comment https://forums.phpfreaks.com/topic/198956-table-problem-s/#findComment-1044380 Share on other sites More sharing options...
UnknownPlayer Posted April 19, 2010 Author Share Posted April 19, 2010 2nd: put the <table> declarations outside the loop, that way you create 1 table and the | will line up. I don't know what is wrong with the 1st. Thanks andrewgauger, it works like u said.. Link to comment https://forums.phpfreaks.com/topic/198956-table-problem-s/#findComment-1044753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.