okrobie Posted July 30, 2010 Share Posted July 30, 2010 How to get this echo line to display as one line? No matter what I have done it displays as two lines. I even tried <nobr></nobr> Teachers Name: John Jones $userid = mysql_real_escape_string($_GET['user_id']); $sql = "select * from users where `id`='$userid' "; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { echo "<h3>Teachers Name: </h3>" . $row["first_name"] . " " . $row["last_name"] ; } Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/ Share on other sites More sharing options...
onlyican Posted July 30, 2010 Share Posted July 30, 2010 Well h3 by default would display on 2 lines Either change your CSS to stop this or stop using the h3 tag. Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093039 Share on other sites More sharing options...
okrobie Posted July 30, 2010 Author Share Posted July 30, 2010 Thanks onlyican. I took away the <h3> and it now displays in one line, but it is in default font. Now how do I get it to display in <h3> style font? Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093047 Share on other sites More sharing options...
Zane Posted July 30, 2010 Share Posted July 30, 2010 Set your CSS accordingly Here are the default font-sizes for heading tags http://style.cleverchimp.com/font_size_intervals/altintervals.html For a quick reference. H3 is equal to font-size: large OR font-size: 24px Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093051 Share on other sites More sharing options...
onlyican Posted July 30, 2010 Share Posted July 30, 2010 if you want to keep your h3 tag for SEO purpose <style> h3{display:inline;} p{ display: inline; } </style> then php echo "<h3>Teachers Name: </h3><p>" . $row["first_name"] . " " . $row["last_name"].'</p> ; } [/code] Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093067 Share on other sites More sharing options...
okrobie Posted July 30, 2010 Author Share Posted July 30, 2010 thanks onlyican, that looks like it should work, but I'm getting a "unexpected $end" syntax error. Am I missing something? (I did put a bracket in front of it) Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093274 Share on other sites More sharing options...
wildteen88 Posted July 30, 2010 Share Posted July 30, 2010 The string isn't being closed properly. Missed off the closing " echo "<h3>Teachers Name: </h3><p>" . $row["first_name"] . " " . $row["last_name"].'</p>" ; } Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093277 Share on other sites More sharing options...
okrobie Posted July 30, 2010 Author Share Posted July 30, 2010 Thanks wildteen88, that is correct but I'm still getting the unexpected $end error. I removed the whole line and the rest of the page displayed correctly without an error. Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093285 Share on other sites More sharing options...
okrobie Posted July 30, 2010 Author Share Posted July 30, 2010 I got it. I changed the ending single quote to a double quote and moved the ending </h3> { echo "<h3>Teachers Name: <p>" . $row["first_name"] . " " . $row["last_name"]."</p></h3>" ; } Thanks for all the help. Quote Link to comment https://forums.phpfreaks.com/topic/209331-how-to-get-this-echo-line-to-display-as-one-line/#findComment-1093319 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.