Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Is this possible

Quote Reply
Is this possible
Hi all

Just wondering if this is possibleUnsure with say a global and please how.

I am using Links SQL to house products from other companies, and one of the fields that they must enter is the price for the product they are selling.

What i would like is to add every price in the directory together and display it on my homepage, for example say i have 10 listings each product has a price of $50 what i would like to show on the homepage is:

There is currently $500 worth of products listed.

Could someone please help me to achive thisSmile.

Kirk


--------------------------------------------------

Life isn't like a box of chocolates ... it's more like a jar of jalapenos. What you do today might burn your ass tomorrow.
Quote Reply
Re: [mekro] Is this possible In reply to
Hi,

Sure, a global could do this:

sub {
return $DB->table('Links')->select ('SUM(Price)')->fetchall_list;
}

and replace Price with the name of the column that stores the price.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Is this possible In reply to
I thought you had to pass in a scalar reference for things like SUM() FLOOR() etc?
Quote Reply
Re: [Paul] Is this possible In reply to
Hi,

Scalar ref means don't quote it. You need this for the where clause (as it's quoted), but columns you want to select are not quoted.

Cheers,

Alex
--
Gossamer Threads Inc.