New Line IN php

Category: Phplist

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

Hits: 11
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.

OTHER ANSWERS

0

Scott
Staff
18,098 Points
2014-08-25 8:36 am EST
Hello,

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?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

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: support@InMotionHosting.com
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!