Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Contests > PHP Programming Contests

PHP Programming Contests Everything to do with the PHP Programming Contests.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2004-10-27, 03:36 AM
Janyer Dominguez
Guest
 
Posts: n/a
Default

I am creating a ecommerce site and the product display page is not comming out the way I would like it to

take a look

I want it to start a new table row if there are more than 4 products and for every 4 products the table must have a new row.

if there are 9 products it should look like this

[] [] [] []
[] [] [] []
[]

like a grid output

What should I do please help me
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2004-11-04, 10:46 AM
Junior Member
 
Join Date: Nov 2004
Posts: 2
himakumar
Default

Hi,

which way u r getting the products info for displaying, from database or else

if u r getting from database
while loop
<tr>
for loop condition<4 or take =4
<td>product</td>
end for
</tr>
end while
Reply With Quote
  #3 (permalink)  
Old 2005-03-17, 06:10 PM
Junior Member
 
Join Date: Mar 2005
Posts: 18
hakperest
Default

I think that it will be good for you that use mysql for your data
__________________
Hossein Haghparast
Ph.D Student of Ankara University ( Economic Sciences)
My Webpage
Reply With Quote
  #4 (permalink)  
Old 2005-12-19, 04:53 PM
Junior Member
 
Join Date: Dec 2005
Posts: 1
neriksmoen
Default

you would probably want to do something such as:

Code:
$query = @mysql_query("SELECT * FROM yourtable");
echo "<table border=1 cellpadding=0 cellspacing=0>";
echo " <tr>";
$thenum = 1;
while($result = @mysql_fetch_array($query))
{
  if($thenum > 4){ $thenum=1; echo "</tr><tr>"; }
  else{ $thenum++; }
  echo "<td>$result[thefield]</td>";
}
echo " </tr>";
echo "</table>";
which is similar to what himakumar was suggesting code-wise, and using the database that hakperest suggested.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:11 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.