WebmasterLingo
JustEdge Dedicated Servers

Go Back   WebmasterLingo > Programming Corner
User Name
Password

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old January 23rd, 2004, 01:22 PM   #1
circuitjump
Registered User
 
Join Date: Jan 2004
Posts: 57
circuitjump is off the scale
Send a message via AIM to circuitjump
Making new rows

Hi All, This is my first post here at webmasterlingo.com. Yaaayyy!!!

I have a small problem that needs solved and I'm running out of ideas to solve it, so I come to the members of this site seeking help.

I have an html table that prints out info passed to it by MySQL. The problem is that some entries are more then 10. what I want it to do is when it hits the first ten, start a new row. So visually it looks like this.

----------------------------------------
tex | text | text // this goes up to ten
----------------------------------------
tex | text | text // this goes up to ten too
----------------------------------------

And at that point I want it to create a new <tr></tr> for the rest of the entries

Here is the code at the moment. It might be a little confusing but any help would be greatly appreciated.

PHP Code:
 while ($count_against <= $count_rooms) {
                                
// this is where I want to tell it to start a new html table row when it hits 10
if () {
                                print 
"<tr>\n";
                                while (
$count_against <= $count_rooms) {
                                
//while ($count_against <= 10) {
                                
print "<td width=\"75\" align=\"center\" valign=\"top\"><div class=\"mainTextMargin\">&nbsp;".$room_title[$count_against]."</div></td>";
                                                        
$count_against++;
                                }
                                
$width 75*$count_against-750;
                                print 
"<td width=".$width.">&nbsp;</td>";
                                print 
"</tr>\n";
                                print 
"<tr>";
                                print 
"<td height=\"1\" colspan=\"45\" class=\"tdBlack\"><img src=\"images/trans.gif\" width=\"1\" height=\"1\"></td>";
                                print 
"</tr>";
                                print 
"<tr>";
                                                    
$count_against 0;
                                while (
$count_against <= $count_rooms) {
                                
//while ($count_against <= 10) {
                                
print "<td width=\"75\" align=\"center\" valign=\"top\"><div class=\"mainTextMargin\">&nbsp;".$room_dimensions[$count_against]."</div></td>";
                                                    
$count_against++;
                                }
                                
$width 75*$count_against-750;
                                print 
"<td width=".$width.">&nbsp;</td>";                                    
                                print 
"</tr>";
                                }
                                }
                                
?> 
circuitjump is offline   Reply With Quote
Old January 23rd, 2004, 01:29 PM   #2
ZYV
PHP addict
 
Join Date: Dec 2003
Location: Russia, Nizhny Novgorod
Posts: 71
ZYV is off the scale
Send a message via ICQ to ZYV Send a message via AIM to ZYV
Try

PHP Code:
 while ($count_against <= $count_rooms) { 
                                
// this is where I want to tell it to start a new html table row when it hits 10
$n 0;
if (
$n 10) {
......... 
your old code ....
$n++;

ZYV is offline   Reply With Quote
Old January 23rd, 2004, 03:32 PM   #3
circuitjump
Registered User
 
Join Date: Jan 2004
Posts: 57
circuitjump is off the scale
Send a message via AIM to circuitjump
Thanks,

I went about a different way less robust but it does the trick, so I'm gonna go ahead and test your way and some other ways this weekend and see what I can come up with.

Thanks for the help
circuitjump is offline   Reply With Quote
Old August 31st, 2005, 06:44 AM   #4
kitty
Registered User
 
Join Date: Aug 2005
Posts: 16
kitty is on a distinguished road
im agree with the one who send this code im tried it before
while ($count_against <= $count_rooms) {
// this is where I want to tell it to start a new html table row when it hits 10
$n = 0;
if (
$n < 10) {
.........
your old code ....
$n++;
}
__________________
NewEra
web develop
kitty is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 01:32 PM.

Windows 2003, cPanel & DirectAdmin Unix Web Hosting