close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Formatting text retrieved from MySql db with php

Thread began 1/05/2012 1:52 am by maftouh | Last modified 1/05/2012 1:31 pm by maftouh | 4428 views | 3 replies

maftouh

Formatting text retrieved from MySql db with php

Hi. I'm working on Dreamweaver CS3 and using Mac OS X 10.4.11 (Tiger) with Safari 4.1.3 web browser

I'd like to know how to format data retrieved from a MySql Data base using PHP.
For Example, in a Basic Contact form, when i want to view the messages, i've used this code :

===================================================
<?PHP
mysql_connect("localhost", "root", "root") or die(mysql_error());
mysql_select_db("contact") or die(mysql_error());

$data = mysql_query("SELECT * FROM client")
or die(mysql_error());

$info = mysql_fetch_array( $data );
?>

<?php
Print "<table border cellpadding=3 align='center' bgcolor='#FFFFFF'>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th bgcolor='#0066FF'><font color='#FFFFFF'>Full Name:</font></th> <td>".$info['fullname'] . "</td> ";
Print "<th>eMail :</th> <td>".$info['<br />email'] . "</td> ";
Print "<th>Phone:</th> <td>".$info['phone'] . "</td> ";
Print "<th>Subject:</th> <td>".$info['subject'] . "</td> ";
Print "<th>Message:</th> <td>".$info['message'] . "</td></tr>";
}
Print "</table>";
?>
===================================================

of course, it works. And now, i want to formate the text on the retrieving page : set a customized font, color, size and so forth. Because, when the messages are printed in an array, they look like this :

=========================================================
Full Name: myname eMail :my email Phone: 123 Subject: the subject Message: text
Full Name: myname 2 eMail :my email2 Phone: 1234 Subject: the subject Message: text
=========================================================

So, it is not nice any more. And also the long is the message, is the width the page will take. And some time it larger the page width and user have to scroll the web browser to left and right in order to see the rest of the message.
So, I'd like to know how can i customize the view of messages retrieved from my MySql Data Base, either using PHP, HTML or CSS, if possible.

Thank you for all

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...