Re: one click - two actions?

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

 



At 1/21/2007 01:54 AM, pub wrote:
I am working on my query as you suggested. I have a joint query that
seems to work except that I get the name of the company repeated for
each job. Could you please help me figure out how to make it echo the
company once and list all the jobs next to it on the same line and
start a new line with the next company like you suggested bellow?


You want to output the company name only when it changes. I usually do this by keeping a variable equal to the previous value in the loop and compare it each time with the current value:

PreviousCompany = '';

while (fetching data records)
{
                if (PreviousCompany != CurrentCompany)
                {
                        output CurrentCompany;
                        PreviousCompany = CurrentCompany;
                }

        output Job;
}


One markup structure you might consider for this application is the definition list:

<dl>
        <dt>Company</dt>
        <dd>job 1</dd>
        <dd>job 2</dd>
        <dd>job 3</dd>
        <dd>job 4</dd>

        <dt>Company</dt>
        <dd>job 1</dd>
        <dd>job 2</dd>
        <dd>job 3</dd>
        <dd>job 4</dd>
        ...
</dl>

Regards,

Paul
__________________________

Juniper Webcraft Ltd.
http://juniperwebcraft.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux