abbacus Posted July 23, 2007 Share Posted July 23, 2007 I am using the following code to connect to a MySQL database to get news information. PageID is the number of the page, PageTitle is the bold news heading, PageImage is the image source to accompany the title and Details is the brief news article. When displayed in Firefox I get everything laid out properly. The Image is on top, then the title then the details. But when i use Internet Explorer I get the details appearing on the right hand side often looking jumbled up. It gets fixed by adding spaces in the html code which i have done, but its hardly versatile. I need a way to make the Details show underneath the other infomration. I would like to know if anyone can help me with what seems to be a cross browser issue for displaying HTML within PHP. <?php include("script/dataconnection.php"); $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'pageinformation'; mysql_select_db($dbname); $query = "SELECT PageID, PageTitle, PageImage, Details, Current, Category FROM pages WHERE Current >=1"; $result = mysql_query($query); $strEmpty = " "; echo "<html>"; echo "<head>"; echo "<title></title>"; echo "<meta http-equiv=Content-Type content=text/html; charset=utf-8>"; echo "<meta http-equiv=Content-Language content=el>"; echo "<link rel=stylesheet type=text/css href=styles/stylos.css charset=utf-8>"; echo "</head>"; echo ""; echo "<body topmargin='0' leftmargin='0'>"; while($row = mysql_fetch_array($result, MYSQL_BOTH)) { if( $row[2] <= $strEmpty) { // echo "<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor=#FFFFFF align=left> <tr> <td width=50> <b><font face=Arial Black color=#336699 size=5> {$row['PageTitle']} </font></b></td> <td width=50> <img border=0 src= {$row['PageImage']} align=---- width=128 height=38> </td></tr></table> "; echo "<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor=#FFFFFF align=left >"; echo "<tr> <td width=100%><font face=Arial Black color=#336699 size=5> {$row['PageTitle']} </font></td></tr></table>"; }else { echo "<table border=0 width=100% bgcolor=#FFFFFF align=left >"; echo "<tr>\n"; echo "<td width=100%> <img border=0 align=left src= {$row['PageImage']} width=128 height=64></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td width=100%><font face=Arial Black color=#336699 size=5>{$row['PageTitle']}</font> </td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td width=100%><font face=Arial Black color=#336699 size=2 align=left> {$row['Details']} </font></td> \n"; echo "</tr>\n"; echo "</table>"; } echo "<p> </p>", "<p> </p>"; //echo "<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor=#FFFFFF align=left><tr> <td width=100%> <p><font face=Arial Black color=#336699 size=2 align=left> {$row['Details']} </font></p></td></tr></table>"; //1055 chars to fill five lines approx 128x128 image if (strlen($row[1]) <= 2000) { echo "<p> </p>"; } if (strlen($row[1]) <= 255) { echo "<p> </p>"; echo "<p> </p>"; } include("templates/datafooter.htm"); $i++; } include("templates/datapagefooter.htm"); echo "</body>"; echo "</html>"; mysql_close($conn); ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 23, 2007 Share Posted July 23, 2007 Check that your html output is correct, right click view source. Nothing to do with PHP. Web browser don't even know what PHP is and PHP doesn't know what a web browser is. It is most probably an HTML error. Add HTML comments into your HTML when a specific function occurs within your PHP code, eg: echo '<!-- INCLUDE footer START -->'; include("templates/datafooter.htm"); echo '<!-- INCLUDE footer END -->'; That way you can see which part of your PHP script has generated which segment of HTML. 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.