Msg#: 4481920 posted 12:50 am on Aug 5, 2012 (gmt 0)
I am writing code to display in the browser the info that's been submitted into the comments database. The comments that users submit using my form should upon submission stretch out across the browers page but it doesn't, instead each word in the paragraph is on it's own line.
HERES THE PHP CODE:
<body> <?php $dbc = mysqli_connect ('dbhost', 'dbusername', 'dbpass', 'bdname') or die('Error connecting to MySQL server.');
$query = "SELECT * FROM comments"; $data = mysqli_query($dbc, $query);
Msg#: 4481920 posted 4:00 am on Aug 5, 2012 (gmt 0)
The problem is that you didn't add a 'width' attribute to the <table> tag that would tell the browser how you wanted the information to be displayed. Try: echo('<table width="100%" cellpadding="4" cellspacing="0" border="0">');
Msg#: 4481920 posted 6:28 pm on Aug 6, 2012 (gmt 0)
Oh and I think that you might be wrong about the way to lay out that table. According to the following infor by jatar_k [webmasterworld.com...] you're suppose to use slashes before the double quotes but only if you're using double quotes to define the echo statement, so it should be written as so, but still yet even with all of thi this info it didn't work:
Make up your mind, willya? ;) Either double quotes on the outside with escaped quotes for the literal quotation marks being echo'd, or double quotes on the outside and single quotes for the literal quotes being echo'd.
:: sitting on hands to avoid introducing wholly tangential CSS motif into discussion ::
Msg#: 4481920 posted 12:06 pm on Aug 7, 2012 (gmt 0)
Amy. Be sure to re check the way it's being stored to the db in the first place. I don't see any reason here that each word would be each on a separate line unless each word is being store in a separate line in the db or the comments are formatted wrong. Also, view the page source of the outputted HTML and see what it looks like. Is there a <br /> tag after each word? Is there a </tr> tag after each word? That should help point you to the culprit creating your problem. Hope that helps.