InMotion Hosting Support Center

New Line IN php

Category: Phplist

n/a Points
2014-08-23 4:51 am EST

Hits: 52
when i retrieve information in php page from database it display every thing in one line but I want break in lines?

You must login before you can ask a follow up question.

You must login before you can submit an answer.



43,761 Points
2014-08-25 8:36 am EST

When you retrieve data from a database, you will want to ensure you format it before printing it out on the screen. Looking at the linked article, check out the second code section in step 2, particularly the piece below. It is a sample of how to format your data. As it is 'echoing the data to the screen in HTML, it simply uses a <br /> tag to create a line break.

while($row = mysql_fetch_array($comments, MYSQL_ASSOC))
$name = $row['name'];
$email = $row['email'];
$website = $row['website'];
$comment = $row['comment'];
$timestamp = $row['timestamp'];

$name = htmlspecialchars($row['name'],ENT_QUOTES);
$email = htmlspecialchars($row['email'],ENT_QUOTES);
$website = htmlspecialchars($row['website'],ENT_QUOTES);
$comment = htmlspecialchars($row['comment'],ENT_QUOTES);

echo "

Name: $name

Email: $email

Website: $website

Comment: $comment

Timestamp: $timestamp


Kindest Regards,
Scott M

You must login before you can post a comment about this answer.

Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!