Print Lines from MySQL into php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thedarkdestroyer
Forum Newbie
Posts: 9
Joined: Thu Sep 28, 2006 9:27 am

Print Lines from MySQL into php

Post 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
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

possible fix

Post 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>";
thedarkdestroyer
Forum Newbie
Posts: 9
Joined: Thu Sep 28, 2006 9:27 am

Post by thedarkdestroyer »

Thanks for that, i removed the <nobr> and it worked fine!!, thanks for that
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

Your welcome

Post 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
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

This is not a PHP code issue... this should have been posted in Client Side or UI/Design
Post Reply