Jump to content

Archived

This topic is now archived and is closed to further replies.

Moron

HTML table formatting in PHP. Help?

Recommended Posts

Okay, I have my code pulling data from the database properly, BUT.... I can't seem to format it right for love or money. I'm good with HTML, so I initially just built an HTML table and then stuck my <?php......?> stuff inside the appropriate table section. Didn't work right.

What I'm trying now is:

[code]<?php

print("<table border=10><tr><td>");

while($RESULT = mssql_fetch_assoc($RESULTDS)){

echo $RESULT['Lmo'];
echo "/";
echo $RESULT['Lda'];
echo "/";
echo $RESULT['LYR'].'<br />'; 

print("</td><td>");

echo $RESULT['Leave Code'].'<br />';
}

print("</td></tr></table>");

?>[/code]

It comes out as:

[img]http://mywebpages.comcast.net/techie4/formatting.gif[/img]

What I want is Leave Date, Leave Type (code), and Hours across each column.

Anybody?

Thanks in advance!

EDIT: My semicolons aren't bumped down to the next line. It just did that when I pasted it here. As I didnt use the [b]CODE[/b] tags.

Share this post


Link to post
Share on other sites
So the first cell should contain a code, the date and some hours, not just the date as it does now? Where will you get the hours from?

Share this post


Link to post
Share on other sites
[quote author=king arthur link=topic=103720.msg413215#msg413215 date=1155220685]
So the first cell should contain a code, the date and some hours, not just the date as it does now? Where will you get the hours from?
[/quote]

From left to right, it should read: Date, Leave Type, Hours, then go to the next line and repeat. The Hours are a table in the database are there's no calculation involved in my code.

Share this post


Link to post
Share on other sites
Just to be clear, you want Date in one cell, Leave Type in the next cell, Hours in the next cell, and then underneath that the next row, and so on?

Share this post


Link to post
Share on other sites
[quote author=king arthur link=topic=103720.msg413230#msg413230 date=1155221733]
Just to be clear, you want Date in one cell, Leave Type in the next cell, Hours in the next cell, and then underneath that the next row, and so on?
[/quote]

Exactly.

And thanks.

Share this post


Link to post
Share on other sites
[code]
<?php

print("<table border=10>");

while($RESULT = mssql_fetch_assoc($RESULTDS)){

echo "<tr>";

echo "<td>";
echo $RESULT['Leave Code'];
echo "</td>";

echo "<td>";
echo $RESULT['Lmo'];
echo "/";
echo $RESULT['Lda'];
echo "/";
echo $RESULT['LYR']; 
echo "</td>";

echo "<td>";
echo $RESULT['whatever your hours field is called'];
echo "</td>";

echo "</tr>";
}

print("</table>");

?>
[/code]

Try that.

Share this post


Link to post
Share on other sites
[quote author=king arthur link=topic=103720.msg413249#msg413249 date=1155222915]
[code]
<?php

print("<table border=10>");

while($RESULT = mssql_fetch_assoc($RESULTDS)){

echo "<tr>";

echo "<td>";
echo $RESULT['Leave Code'];
echo "</td>";

echo "<td>";
echo $RESULT['Lmo'];
echo "/";
echo $RESULT['Lda'];
echo "/";
echo $RESULT['LYR']; 
echo "</td>";

echo "<td>";
echo $RESULT['whatever your hours field is called'];
echo "</td>";

echo "</tr>";
}

print("</table>");

?>
[/code]

Try that.
[/quote]

Works!

You really ARE the king!

Thanks!

:)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.