Page 1 of 1

Print Lines from MySQL into php

Posted: Wed Oct 04, 2006 8:51 am
by thedarkdestroyer
Hi All,

I am trying to print out rows from a MySQL Database, I want all columns except one on one line and the Messages column on another line, i have managed to do that, but i cannot get the Messages row to extend the full width of the page, here is the code i am using:

Code: Select all

echo " This is a list of completed tasks.";
echo "<table width=100%, border=2>";
echo "<table width=100%, border=2>";
while ($i < $num)
{
$ID=mysql_result($result,$i,"ID");
$Name1=mysql_result($result,$i,"Name1");
$Name2=mysql_result($result,$i,"Name2");
$Company=mysql_result($result,$i,"Company");
$Telephone=mysql_result($result,$i,"Telephone");
$Message=mysql_result($result,$i,"Message");
$Date=mysql_result($result,$i,"Date");
echo "<td width=2%>$ID</td><td width=8%>$Name1</td><td width=12%>$Name2</td><td width=8%>$Company</td><td width=10%>$Telephone</td><td width=10%>$Date</td></tr>";
echo "<td width=80%>$Message</td></tr>";
$i++;
}
echo "</table>";
echo "</table>";
?>
but it looks like this:

__________________________________________________________
l l l l l
6 l Mr Bloggs l 012312325452 l 10/10/2006 l ACME l
_________l________________________________________________l
l
Call back l
regarding l
the order l
for replace l
ment stock l
_________l______________________________________________

and i would like t to look like this:

_________________________________________________________
6 l Mr Bloggs l 012312325452 l 10/10/2006 l ACME
_________________________________________________________
Call back regarding the order for replacement stock
_________________________________________________________




Anyone any ides????

Thanks

possible fix

Posted: Wed Oct 04, 2006 11:43 am
by churt
Not sure what screen resolution but try the following for the message line.

echo "<td colspan=6 width=80%><nobr>$Message</td></tr>";

Posted: Thu Oct 05, 2006 5:38 am
by thedarkdestroyer
Thanks for that, i removed the <nobr> and it worked fine!!, thanks for that

Your welcome

Posted: Thu Oct 05, 2006 7:22 am
by churt
With a column span of 6 I didn't think the <nobr> would be needed. I usually throw it in out of habbit when I want something to stay on the same line.

Anyway, your most welcome. I enjoy it when I actually have an answer for someone :D

Later,
C

Posted: Thu Oct 05, 2006 10:15 am
by Luke
This is not a PHP code issue... this should have been posted in Client Side or UI/Design