jkkenzie Posted July 22, 2008 Share Posted July 22, 2008 The below part does not appear at the top of my page, it goes to the center if the next <td> is longer ON MOZILLA not IE. <table bgcolor="#ff9900"> <tr><td width="19%" align="center"> <table height="20%" ><tr><td align="center"> <h3><u><font color="#009933">Latest News</font></u></h3> <?php /* make database connection */ $db = mysql_connect ('localhost','root',''); mysql_select_db ('emobase',$db); /* Get News */ $query = "SELECT id,title," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate ASC"; $result = mysql_query ($query); while ($row = mysql_fetch_assoc ($result)) { $title = htmlentities ($row['title']); echo "<h5 align='center'><li><font color='#000000'><a href='news.php" . "?action=show&id={$row['id']}'></font>$title</li></h5>" ; } ?> </td></tr><tr><td></td></tr></table> </td> The full code below: <body bgcolor="#FFFFCC"> <table width="100%" height="5%" background="./images/header.jpg"> <tr><td width="30%" height="122" align="left"><img src="logos/EMO%20Logo%20450.png" align="left" width="120" height="110"></td> <td width="30%" align="center"><font size="+1" color="#0000CC"> EMO INVESTMENTS LIMITED</font><br><br> <a href="Emo Application Individual-Corporate.zip">Download Shares Application Form Individual/Corporate</a> </td> <td width="40%" align="right"><script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0','width','120','height','120','accesskey','12','tabindex','12','title','emo','src','slogan','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','slogan' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0" width="120" height="120" accesskey="12" tabindex="12" title="emo"> <param name="movie" value="slogan.swf"> <param name="quality" value="high"> <embed src="slogan.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="123"></embed> </object></noscript></td></tr></table> <table width="100%" bgcolor="#ff9900"><tr><td width="40%" height="21"> <div id="colorblink_id" >menu holder</div> <script type="text/javascript"> var fo = new FlashObject("emoinvestments.swf","colorblink","475","25","6","#000000"); fo.addParam("menu","false"); fo.addParam("quality","best"); fo.addParam("salign","LT"); fo.addParam("scale","noscale"); fo.addParam("wmode", "transparent"); fo.write("colorblink_id"); </script> </td><td width="60%"><iframe src="http://www.nellydata.com/dsl/ticker.asp" frameborder="0" scrolling="no" style="width:100%;height:18px;padding:0px;">Your browser is not iframe enabled. Please upload a higher version.</iframe></td></tr></table> <table bgcolor="#ff9900"> <tr><td width="19%" align="center"> <table height="20%" ><tr><td align="center"> <h3><u><font color="#009933">Latest News</font></u></h3> <?php /* make database connection */ $db = mysql_connect ('localhost','root',''); mysql_select_db ('emobase',$db); /* Get News */ $query = "SELECT id,title," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate ASC"; $result = mysql_query ($query); while ($row = mysql_fetch_assoc ($result)) { $title = htmlentities ($row['title']); echo "<h5 align='center'><li><font color='#000000'><a href='news.php" . "?action=show&id={$row['id']}'></font>$title</li></h5>" ; } ?> </td></tr><tr><td></td></tr></table> </td> <td width="10%"></td> <td width="70%"> <?php /* user config variables */ $max_items = 5; /* max number of news items to show */ /* make database connection */ $db = mysql_connect ('localhost','root',''); mysql_select_db ('emobase',$db); function displayNews($all = 0) { /* bring in two variables * $db is our database connection * $max_items is the maximum number * of news items we want to display */ global $db, $max_items; /* query for news items */ if ($all == 0) { /* this query is for up to $max_items */ $query = "SELECT id,image,author,title,newstext," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate ASC LIMIT $max_items"; } else { /* this query will get all news */ $query = "SELECT id,image,author,title,newstext," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate ASC"; } $result = mysql_query ($query); while ($row = mysql_fetch_assoc ($result)) { /* display news in a simple table */ echo "<TABLE border='0' cellpadding='0' align='center' width='800'>"; /* place table row data in * easier to use variables. * Here we also make sure no * HTML tags, other than the * ones we want are displayed */ $date = $row['date']; $title = htmlentities ($row['title']); $news = nl2br (strip_tags ($row['newstext'], '<a><b><i><u>')); $image = $row['image']; $author = $row['author']; /* display the data */ echo "<TR><TD><b><h4>$title</h4></b> posted on $date </TD></TR>"; if($image==""){ $imageurl=""; }else{ $imageurl="<img src='images/". $image ."'></img>"; } echo "<TR><TD>$imageurl</TD></TR><br>"; echo "<TR><TD> $news </TD></TR><br>"; echo "<TR><TD align ='left'><b>$author</b></TD></TR><br><br>"; /* get number of comments */ $comment_query = "SELECT count(*) FROM news_comments " . "WHERE news_id={$row['id']}"; $comment_result = mysql_query ($comment_query); $comment_row = mysql_fetch_row($comment_result); /* display number of comments with link */ echo "<TR><TD><a href='{$_SERVER['PHP_SELF']}" . "?action=show&id={$row['id']}'>View and Add Comments</>" . "($comment_row[0])</TD></TR>"; /* finish up table*/ echo "</TABLE>"; echo "<BR>"; } /* if we aren't displaying all news, * then give a link to do so */ if ($all == 0) { echo "<a href='{$_SERVER['PHP_SELF']}" . "?action=all'>View all news</a>"; } } function displayOneItem($id) { global $db; /* query for item */ $query = "SELECT * FROM news WHERE id=$id"; $result = mysql_query ($query); /* if we get no results back, error out */ if (mysql_num_rows ($result) == 0) { echo "Bad news id"; return; } $row = mysql_fetch_assoc($result); echo "<TABLE border='0' width='800'>"; /* easier to read variables and * striping out tags */ $title = htmlentities ($row['title']); $news = nl2br (strip_tags ($row['newstext'], '<a><b><i><u>')); $image = $row['image']; $author = $row['author']; /* display the items */ echo "<TR><TD><b>$title</b></TD></TR><br>"; if($image==""){ $imageurl=""; }else{ $imageurl="<img src='images/". $image ."'></img>"; } echo "<TR><TD>$imageurl</TD></TR><br>"; echo "<TR><TD>$news</TD></TR><br><br>"; echo "<TR><TD align ='left'><b>Author: </b>$author</TD></TR>"; echo "</TABLE>"; echo "<BR>"; /* now show the comments */ displayComments($id); } function displayComments($id) { /* bring db connection variable into scope */ global $db; /* query for comments */ $query = "SELECT * FROM news_comments WHERE news_id=$id"; $result = mysql_query ($query); echo "Comments:<BR><HR width='300'>"; /* display the all the comments */ while ($row = mysql_fetch_assoc ($result)) { echo "<TABLE border='1' width='300'>"; $name = htmlentities ($row['name']); echo "<TR><TD><b>by: $name</b></TD></TR>"; $comment = strip_tags ($row['comment'], '<a><b><i><u>'); $comment = nl2br ($comment); echo "<TR><TD>$comment</TD></TR>"; echo "</TABLE>"; echo "<BR>"; } /* add a form where users can enter new comments */ echo "<HR width='300'>"; echo "<FORM action='{$_SERVER['PHP_SELF']}" . "?action=addcomment&id=$id' method=POST>"; echo "Name: <input type=\"text\" " . "width='30' name='name'><BR>"; echo "<TEXTAREA cols='40' rows='5' " . "name='comment'></TEXTAREA><BR>"; echo "<input type='submit' name='submit' " . "value='Add Comment'"; echo "</FORM>\n"; } function addComment($id) { global $db; /* insert the comment */ $query = "INSERT INTO news_comments " . "VALUES('',$id,'{$_POST['name']}'," . "'{$_POST['comment']}')"; mysql_query($query); echo "Comment entered. Thanks!<BR>"; echo "<a href='{$_SERVER['PHP_SELF']}" . "?action=show&id=$id'>Back</a>"; } /* this is where the script decides what do do */ echo "<CENTER>"; switch($_GET['action']) { case 'show': displayOneItem($_GET['id']); break; case 'all': displayNews(1); break; case 'addcomment': addComment($_GET['id']); break; default: displayNews(); } echo "</CENTER>"; ?> </td><td width="10%"></td></tr></table></div> </Body> </html> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2008 Share Posted July 22, 2008 Sorry? This doesn't sound like a PHP issue, but can you at least explain what the problem is? Browser issues are usually best when accompanied by a demo we can see. Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted July 22, 2008 Share Posted July 22, 2008 I haven't looked, but it probably means your HTML is wrong. If the code isn't perfect, different browsers have different ways of rendering incorrect code. Gimme a minute, I'll have a look through. ---------------- Now playing: Get Cape. Wear Cape. Fly - Let The Journey Begin via FoxyTunes Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted July 22, 2008 Share Posted July 22, 2008 Your addComment() function doesn't contain HTML for the table (<tr><td>$stuff</td></tr) ---------------- Now playing: Get Cape. Wear Cape. Fly - Waiting For The Monster To Drown via FoxyTunes Quote Link to comment Share on other sites More sharing options...
jkkenzie Posted July 23, 2008 Author Share Posted July 23, 2008 let me try looking at that 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.