beshoo
|
Posted: 01/20/2002, 4:28 PM |
|
hi 4 all
in the Bookstore we have a category section in the INDEX page
OK
what I need is to view the cont of the each category
like this :
Html and web (50)
Database and programming (24)
Photo books (2)
Smart thing (30)
i just like to view the cont of the each category (count)
so what the code i have to add ?
|
|
|
Nicole
|
Posted: 01/21/2002, 2:12 AM |
|
Beshoo,
you should use custom sql for the form. In case you use BookStore db the sql would be like:
select c.name, count(i.item_id) as cat_count from categories as c, items as i where c.category_id=i.category_id group by c.category_id
|
|
|
beshoo
|
Posted: 01/21/2002, 5:49 AM |
|
please ful php code :)
|
|
|
Nicole
|
Posted: 01/21/2002, 6:22 AM |
|
Beshoo,
you don't need manual PHP code in this case. Just create CC Grid form, add the proposed sql to SQL tab, click OK to return to the form and select fields to be displayed on the form.
|
|
|
beshoo
|
Posted: 01/22/2002, 7:15 AM |
|
HI 4 all
i put it like what u told me
select c.name, count(i.item_id) as cat_count from categories as c, items as i where c.category_id=i.category_id group by c.category_id
like it .
put it did not work
i nead that the count number appear close to the category name not
in new field
and between ()
boks(20)
HTML codes(30)
|
|
|
laxman
|
Posted: 01/22/2002, 11:57 AM |
|
i tray it and it is not work
|
|
|
beshoo
|
Posted: 01/22/2002, 11:55 PM |
|
up
|
|
|
Nicole
|
Posted: 01/23/2002, 5:47 AM |
|
Beshoo,
in this case my advise is to use custom sql to be able to select the proper field values. Use PHP without templates pattern in order to make all changes inside CC project, otherwise you should edit generated .html file. I assume you use templateless pattern. In this case create CustomShow event and edit html code the way you need.
|
|
|
beshoo
|
Posted: 01/23/2002, 12:39 PM |
|
please Nicole help me
to do it in PHP
what the code i have to type it
please Nicole i neade your help
beshoo will be sad girl if you dont help
|
|
|
CodeCharge Support
|
Posted: 01/24/2002, 1:29 AM |
|
Beshoo,
please refer to latest support response in our support system on this issue.
|
|
|
Chris Dolan
|
Posted: 01/24/2002, 5:07 AM |
|
Beshoo, this is advice I was given in Nove last year, it works * my site uses this - www.fusionbuilders.com
Open Categories Grid / Form properties/Events/Before Show event
use this code :
number_of_items = cn.execute("select count(*) from items group by
category_id =" & fldcategory_id).fields.item(0)
fldname = fldname & "(" & number_of_items & ")"
Note : remember to add a hidden field category_id
--
Alex
|
|
|
beshoo
|
Posted: 01/24/2002, 9:19 AM |
|
Thank you .
can i have a cc file just for this ?
info@phpyes.com please:)
|
|
|
beshoo
|
Posted: 01/24/2002, 9:21 AM |
|
i nead it in PHP :)
|
|
|