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

Load file in PHP
I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a

Quick fix: Conditional statement with an array
Hi, I'm getting the temperature value off of the Environment Canada website along with the icon file

Save User Inputs while javascript reloading!
hi..
i have written a PHP code in which i reload the page when user selects a value in dropdown..

php code to accept and delete incoming data
Using following HTML Code please show me how to write PHP code to accept and delete the incoming dat

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

Doubles are giving me problems
Ok so, first of all i made a double = 0.05, but when running the debugger it shows up as 0.04999. I

Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,

In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

Probably Easy, Need help with Check Boxes in PHP Code
hello,

Thanks for looking this over and helping me out. My problem is I have a online store l

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