Trouble with HTML/PHP: Formatting Problems

We may earn a small commission from affiliate links and paid advertisements. Terms


Senior Member
Ok, so I'm trying to setup a table that will print an unbroken string of characters in a formatted way. Here is my code:


<style type="text/css">

mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('yddb') or die(mysql_error());

$query = "SELECT*FROM isolates WHERE db_num=$selectnum";
$result = mysql_query($query);

$row = mysql_fetch_array($result);

echo "

echo $selectnum;
echo "


echo "Isolate #";
echo $row['db_num'];
echo "
echo "Name: ";
echo $row['name'];
echo "
echo "Sequence:
echo "<table width='10' border=1><td STYLE='word-wrap:break-word;width:10;left:0'>";
echo $row['seq'];
echo "</td>";



where it says [echo "<table width....etc" ] I am retrieving a very long string (up to 5000 characters) of unformatted text that I need to format to fit inside a table. Just so I don't have to answer it, what I'm outputting are DNA sequences, that's why they're so long.

Does anyone know how to do this? I have the CSS code there, but it doesn't work in Firefox or Safari (and it needs to). Please help :worthy:


Senior Member
Ok, I fixed it using the "chunk_split" command after trimming all the spaces in the $text by using str_replace(" ","", $text);. Well, I guess this can be locked/deleted because I figured it out. Sorry for the unessiary post, but I was stumped there for a while.


wow. thats one hell of a FUCKED UP style sheet.

you shoudl probably close your style tag,
close your head tag,
and open a body tag
before you attempt to print a table.

you should probably run your results through the w3 validator if you want it to work cross-broweser.

Battle Pope

Well-Known Member

I was gonna say... there are opening tags... but where are the closing ones?