Help Spliting PHP Code into two columns

Discussion in 'HTML & Website Design' started by LeanBulk, Sep 7, 2007.

  1. #1
    Alright, so I had some guy create this php script for me that is basically a workout logger. When you go to print your workouts however, they are just in one column running down the page. So, if you have multiple workouts, it is going to take two sheets of paper to print them all out. What I want to do is split the workouts evenly into two columns no matter how many workouts are present. Here is my code so far:

    
    
    <tr>
    	<td align="center">
    
    		<div align="left">
    			
    
    
    					    <table width="100%" cellpadding="0" cellspacing="0" border="0" align="">
    						<?php 
    						//echo'cxzccz  '. $_REQUEST[work_id];
    						 $sl=mysql_query("select * from lift where workt_id = '".$_REQUEST[work_id]."'");
    						while($sl1=mysql_fetch_array($sl)){
    						?>
    				          <tr>
    				         <td align="center" nowrap >
                             <U><h4><?php 	echo $sl1['liftname'];?></h4></U> 
    						 </td>												    
    						</tr>
    						<TR>
    							<TD height="10"></TD>
    						</TR>
    							<?php if ($sl1['lift_id']!=''){
    							  $s2=mysql_query("select * from  sets where lift_id='".$sl1['lift_id']." '");
    							 if(mysql_num_rows($s2)>0){
    							?>
    						 <tr>
    						  <td align="" nowrap >
    					       <TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
    						    <TR>
    						
    							<TD width="25%" align="center" valign="top">
    								  <B>Weight</B>								  </TD>
    							<TD width="25%" align="center" valign="top">
    								  <B>New Weight</B>								  </TD>
    					
    							<TD width="25%" align="center" valign="top"><B>Reps</B></TD>
    							<TD width="25%" align="center" valign="top"><B>New Reps</B></TD>
    							
    						   </TR>
    						    <TR>
    							<TD colspan="4" height="10"></TD>
    						   </TR>
    					      </TABLE>
    					 </td>												    
    					</tr>
    						 <?php
    						   while($sl2=mysql_fetch_array($s2)){
    						 ?>
    					   <tr>
    						 <td align="" nowrap >
    							<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
    								<TR>
    								
    									<TD width="25%" align="center" valign="top"><?php echo $sl2['sets'];?></TD>
    									<TD width="25%" align="center" valign="top">__________</TD>
    									<TD width="25%" align="center" valign="top"><?php echo $sl2['rep'];?></TD>
    									<TD width="25%" align="center" valign="top">__________</TD>
    									
    								</TR>
    								<TR>
    									<TD colspan="6" height="10">&nbsp;</TD>
    								</TR>
    							</TABLE>
    						 </td>												    
    						</tr>
    						
    				<?php 
    					}
    				  }
    				 }
    
    				
    			}?>
    				<TR>
    							<TD align="center"><INPUT TYPE="button" value="Print" onclick="print()">&nbsp;&nbsp;<INPUT TYPE="button" value="Close" onclick="window.close()"></TD>
    						</TR>
    				</table>
                 
    		
    		
    		</div>
    	</div>
    	<!--
    	<div style="margin-top:6px">
    		<input type="submit" class="button" value="Go Back" accesskey="s" onclick="history.back(1); return false" />
    	</div>
    	-->
    	</td>
    </tr>
    </table>
    
    </div>	
    	</div>
    </div>
    
    PHP:
    The first image below is what it looks like currently, and the second image below is what I want it to look like.



    Thanks for all your help!
     

    Attached Files:

    LeanBulk, Sep 7, 2007 IP
  2. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #2
    could set a counter so it will display 2 sets in a table then take a new row when the counter gets to 2, reset it to 0 and thats that.

    Could do it. But why not get the person who made it for you do it?
     
    twistedspikes, Sep 7, 2007 IP
  3. LeanBulk

    LeanBulk Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well, I am not trying to offend anyone here, but the experience with elance and working with a foreign coder simply did not work out. I have went through so much to get where I am currently.....unfortunately, that is not really an option anymore.
     
    LeanBulk, Sep 7, 2007 IP
  4. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Ah I see what you mean.

    I'll see what I can do with the code.
     
    twistedspikes, Sep 7, 2007 IP