Re: formating results in seperate tables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

you should try using a "while" loop instead of a "for".

So write "while ($threadResults = db_fetch($threadQuery)) { ..."

The for loop might produce an additional row in your result.

Good luck,
Storm

"Aaron Wolski" <aaronjw@martekbiz.com> schrieb im Newsbeitrag
004301c34575$943f4350$0203a8c0@AJW2">news:004301c34575$943f4350$0203a8c0@AJW2...
> Hi All,
>
> Having some issues with the code below:
>
> <?php
>
>             }
>
> ?>
>                                     <tr valign="top">
>
> <?php
>
>
>             $col = explode(",",$threadsColumn);
>
>             $col_search = "(";
>                         for ($i=0;$i<count($col);$i++) {
>
>                                     $col_search .= $col[$i]." LIKE
> '%$threadsName%'";
>                                                 if ($i != (count($col) -
> 1)) {
>                                                 $col_search .= " OR ";
>                                                  }
>                         }
>
>             $col_search .= ")";
>
>             $threadQuery = db_query("SELECT * FROM kcs_threads WHERE
> $col_search GROUP BY id");
>
>             if (db_numrows($threadQuery) >0) {
>
>                         for ($i=0;$threadResults =
> db_fetch($threadQuery);$i++) {
>
>
> ?>
>                                                 <td>
>                                                             <table
> width="340" border="0" cellspacing="0" cellpadding="0">
>
>
> <tr>
>
> <td class="adminThreadsDisplayText" align="left"><?php echo
> trimString($threadResults["manufacturer"],13); ?><br><img
> src="../Graphics/spacer.gif" width="85" height="2"></td>
>
> <td class="adminthreadsDisplayText" align="center"><?php echo
> $threadResults["colourID"]; ?><br><img src="../Graphics/spacer.gif"
> width="85" height="2"></td>
>
> <td class="adminthreadsDisplayText" align="center"><?php echo
> $threadResults["type"]; ?><br><img src="../Graphics/spacer.gif"
> width="85" height="2"></td>
>
> <td class="adminthreadsDisplayText" align="center"><a
> href="threadsedit.php?id=<?php echo $threadResults[id]; if
> ($threadsColumn != "") echo "&threadsColumn=$threadsColumn"; if
> ($threadsName != "") echo "&threadsName=$threadsName"; ?>"><font
> class="adminEditLink">Edit</font></a>&nbsp;&nbsp;<a
> href="threadsdelete.php?id=<?php echo $threadResults[id]; if
> ($threadsColumn != "") echo "&threadsColumn=$threadsColumn"; if
> ($threadsName != "") echo "&threadsName=$threadsName"; ?>"><font
> class="adminEditLink">Delete</font></a><br><img
> src="../Graphics/spacer.gif" width="85" height="2"></td>
>
> </tr>
>                                                             </table>
>                                                 </td>
>                                                 <td><img
> src="../Graphics/spacer.gif" width="20" height="1"></td>
> <?php
>
>                         if ($i%2) {
>
> ?>
>                                     </tr>
>                                     <tr valign="top">
>
> <?php
>
>                                     }
>                         }
>             }
>
>             else {
>
> ?>
>                                                 <td
> class="adminNoResultsText" colspan="3" align="center"><br><br>There Are
> No Results Matching Your Search Criteria.</td>
> <?php
>
>             }
>
> ?>
>                                     </tr>
>
>
> This is producing an additional <td><img src="../Graphics/spacer.gif"
> width="20" height="1"></td> within the <tr></tr> tags.
>
> Any clues what's up?
>
> Thanks!
>
> Aaron
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux