formating when pulling data from a mysql database


Posted on 16th Feb 2014 07:03 pm by admin

Ok so Im not to sure if this is the right thread to post in but here is my catch 22 issue.

I have a test web page www.aandstech.com.au/test.php

Test.php pulls its content from a my sql table.
This works fine.

When I pull down the info without
Code: [Select]<pre>code to retrieve data from mysql database</pre>tags I loose all my formating ie carraige returns. However the justify works fine.

When I use my Code: [Select] <pre> tages to retrieve data from mysql database the carrige returns are fine however the text goes right accross the entire page and not within its div.

I have made some headway into resolving this issue by using Code: [Select]<pre width="80"></pre>However this fix looks fine in firefox 3 but has absoultley no effect in ie6 through to 8.0.

Anyway heres a snippet of my code any help would be greatley appreciated.
Code: [Select][color=red]<div class="body">

<p> <?php
$db =mysql_connect("localhost", "******", "*******");
mysql_select_db("*****_*****",$db);
$result = mysql_query("SELECT * FROM ***** WHERE id = 1",$db);

while($myrow = mysql_fetch_array($result))
{
echo "<pre width='80'>";
echo "<font face='Lucida Sans Unicode' size=2>";
echo $myrow["data"];
echo "</font>";
echo "</pre>";

}

?>
</p>

</div>[/color]
Another thing is that Im using css and any text pulled from a table doesn't use the css thats why I had to put the fonts in.

No comments posted yet

Your Answer:

Login to answer
338 Like 21 Dislike
Previous forums Next forums
Other forums

Pagination won't carry results past page 2.
Hi all,

I've worked out my pagination script and its paginating fine until I click next from

Displaying an image using echo command
I had done a query on my database, one of the fields being an image reference to a directory where a

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet

order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea

If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

Help with Password Encoding/Decoding?
Trying to design a "change password" tool. On my signup code I'm using base64_encode, now

php global variable
how can we create global variable so we can use its value in any form.. Please give example to

Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem: I have below button declaration in markup of the aspx page:

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash