Hi everybody,

Now,this table print in vertical(one by one) type.but i need table print the following method.

how can,i make it,plz help me.

1 6 11 etc .....
2 7 12 etc
3 8 13.
4 9 14
5 10 15 etc

    this is the mysql query

    $planbook_obj= Doctrine_Query::create()->select('p.personal_id,p.photo,p.title_name,p.zone_id,p.place,p.occasion,p.itinerary,p.description,p.date')->from('planbook p');
 $result = $planbook_obj->fetchArray();
   //  var_dump($result);
         $this->planbooks = $result;


<div id="planbook" class=
"planbook-item">
<ul class="planbook-list" >
<?php foreach ($planbooks as $planbook): ?>

<div id="planbook-item"" class="float-left" style="width:400px;height:200px;">
<div class="float-left">
<table  style="border: medium double red;
border-collapse: separate; border-spacing: 10pt 5pt">
<tr> <td><img src="/uploads/planbooks/<?php echo $planbook['photo'] ?>" alt="" /><td></tr>
<tr>
<td>
 Title: <?php echo $planbook['title_name'] ?></td></tr>
 <tr><td>
 Country: <?php echo $planbook['country_id'] ?><br></td></tr>
 <tr><td>
 <span class="filed-label">Area: <?php echo $planbook['zone_id'] ?><br></td></tr>
 <tr><td>
 <span class="filed-label">Place: <?php echo $planbook['place'] ?><br></td></tr>
 <tr><td><span class="filed-label">Occasion: <?php echo $planbook['occasion'] ?><br></td></tr>
<tr><td> <span class="filed-label">Itinerary: <?php echo $planbook['itinerary'] ?><br></td></tr>
 <tr><td><span class="filed-label">Date: <?php echo $planbook['date'] ?><br></td></tr>
 <tr><td><span class="filed-label">Description: <?php echo $planbook['description'] ?><br></td></tr>
 </table>
 <div class="clear-both"></div>

Recommended Answers

All 2 Replies

Hi,

Try putting your <table> tags, before the foreach loop as in.. ( Reminder: I am just following your coding style, which I always do most of the time, when posting response, but in my own projects I must use smarty or twig, because I really hate mixing php and html codes in one page..)

        <table>
        <!-- you can use header cells instead -->
        <tr><th>Col Title 1</th><th>Col Title 2 </th> <th><!-- put the rest here --></th></tr>
        <?php
        foreach($those as $this){

        ## begin distributing your data in their own row and td
        ?>
        <tr>
        <td><?php echo $this['item1'];?></td><td><?php echo $this['item2'];?></td><td><!-- add more as needed by your requirements --></td>
        </tr>
        <!-- watch out! below is the end of the loop -->

        <?php

        }
        ## end of foreach loop
        ?>

        </table>

I thought this project was based on symfony.. Didn't symfony already have its own twig templating system in it?

How to print layout records Horizontall and vertically

hi veedeoo,Thanks for ur reply,
I have a users table So say display 5 records then take a new row, display 5 records, take a new row...

anybody.plz help me.how to display table ?
sry for bad english

Title:                     Title:         Title:   
Country:                   Country:        Country:
Area: 0                    Area: 0
Place:                     Place:
Occasion:                  Occasion:
Itinerary:                 Itinerary:
Date:                       Date:
Description:                Description:

Title:                       ...
Country:                      ...
Area: 0
place
occasion
itinerary
Date
Description

Title:                     .....
Country:
Area: 0
place
occasion
itinerary
Date
Description                          
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.