Jump to content

Recommended Posts

Hello, I have a small problem withe thayout of images.

 

I basically have some images/text and I want to put them into a table, Though my problem is I only want to have 5 images/text per coloumn.

 

Here is my code:

<?php if ($row['onpool'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Pool</span></td>
              </tr>
            </table>');  
		}  
		if ($row['oncar'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Car Park Area</span></td>
              </tr>
            </table>');  
		}     
		if ($row['onenter'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Entertainment</span></td>
              </tr>
            </table>');  
		} 
		if ($row['onrest'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Resturant/ Cafe</span></td>
              </tr>
            </table>');  
		}   
		if ($row['onlaun'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Laundret</span></td>
              </tr>
            </table>');  
		} 
		if ($row['onsuper'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Supermarket</span></td>
              </tr>
            </table>');  
		} 
		if ($row['ongym'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Gym</span></td>
              </tr>
            </table>');  
		} 
		if ($row['onbar'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Bar</span></td>
              </tr>
            </table>');  
		} 
		if ($row['ongolf'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Golf</span></td>
              </tr>
            </table>');  
		} 
		if ($row['ontennis'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="72" valign="middle"><span class="style3">Tennis Courts</span></td>
              </tr>
            </table>');  
		} 
		if ($row['onchildplay'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="100" valign="middle"><span class="style3">Childrens Play Area</span></td>
              </tr>
            </table>');  
		} 
		if ($row['onchildclub'] == "yes"){ 
		echo ('<table width="100" border="0">
              <tr>
                <td width="18" valign="middle"><img src="./images/tick.jpg" width="18" height="18" /></td>
                <td width="100" valign="middle"><span class="style3">Childrens Club</span></td>
              </tr>
            </table>');  
		} 
		?>

Please help me, Thanks soooo much 
Sean

Link to comment
https://forums.phpfreaks.com/topic/109916-please-help-thanks/
Share on other sites

1) Don't create a table for each entry.

2) 90% of that code is the same thing... you can reduce it GREATLY.  Your if portion should only be around the second <td> element.

3) You're not showing us the loop that pulls from the database.

4) Are you creating a row that you're not showing us here?

Link to comment
https://forums.phpfreaks.com/topic/109916-please-help-thanks/#findComment-564035
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.