Re: product listing columns
| From: | PJ | Date: | Thu, 21 May 2009 00:23:09 +0000 |
| Subject: | Re: product listing columns | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292848@lists.php.net to get a copy of this message | ||
Ashley Sheridan wrote:
> On Wed, 2009-05-20 at 19:20 -0400, PJ wrote:
>
>> Ashley Sheridan wrote:
>>
>>> On Wed, 2009-05-20 at 17:47 -0400, PJ wrote:
>>>
>>>
>>>> Forgot: you can get an idea of what I'm trying to do at
>>>> http://www.chiccantine.com/preview.html
>>>> --
>>>> Hervé Kempf: "Pour sauver la planète, sortez du
>>>> capitalisme."
>>>> -------------------------------------------------------------
>>>> Phil Jourdan --- pj@ptahhotep.com
>>>> http://www.ptahhotep.com
>>>> http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>>
>>>>
>>>>
>>> The link you gave doesn't exist online, I'm getting a 404. What do you
>>> mean by a list in columns? Do you want a mysql select to be output as
>>> several columns of data, or one column per select?
>>>
>>>
>> :-[ sorry bout that... should have checked - was working with my mouth
>> & not my brain.
>>
>> It works now. I forgot to upload.
>> hadn't thought about how many columns per select... ???
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -------------------------------------------------------------
>> Phil Jourdan --- pj@ptahhotep.com
>> http://www.ptahhotep.com
>> http://www.chiccantine.com/andypantry.php
>>
>>
>>
> So you want the sql select to be dumped into a table as it exists in the
> database?
>
> There is a simple way to do this, if you know which fields are in your
> table, and that is just to use a while loop to iterate your records, and
> then explicitly output each field as you want it. This is the preferred
> way, and how I'd do it if I were you.
>
> print '<table>';
> // put column headers here
> $query = "query here";
> $result = mysql_query($query);
> while($row = mysql_fetch_array($result))
> {
> print '<tr>';
> print "<td>{$row['field1'])</td>";
> print "<td>{$row['field2'])</td>";
> print "<td>{$row['field3'])</td>";
> // etc
> print '</tr>';
> }
> print '</table>';
>
>
Thanks, Ashley,
So, you're advocating using tables...
I thought it might be interesting to do the columns with <div> inline
and then populate them with the query results. It worked marvellously
for the navigation layout and I was able to add background and color to
the product page, regardless which product page we're showing. Quite
neat, really, and very simple. Anyway, I'm going to try.
I must be nuts or something like glutton for punishment, but when you
get it working, it's quite a satisfaction. :-) Thanks again.
--
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php