Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
ASP - prebrojavanje zapisa u tablici
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
Codemaster



Joined: 11 Jul 2006
Posts: 189
Location: Metkovic

PostPosted: 05.10.2006 16:44    Post subject: ASP - prebrojavanje zapisa u tablici Add user to your forum ignore list Reply with quote

Ovako:

imam u access bazi tablicu "users" i želim prebrojati zapise u njoj kako bih to mogao postaviti na naslovnicu kao neku statistiku, npr:

Broj registriranih korisnika: 1024

Kako to mogu napraviti?
btw. jako mi je hitno, site mora biti gotov u roku danas Smile

_________________
Let's play!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 05.10.2006 16:57    Post subject: Add user to your forum ignore list Reply with quote

SELECT COUNT(*) as user_count FROM users

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Codemaster



Joined: 11 Jul 2006
Posts: 189
Location: Metkovic

PostPosted: 05.10.2006 17:00    Post subject: Add user to your forum ignore list Reply with quote

kako ću to ispisati?

Response.Write(šta?)

_________________
Let's play!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 05.10.2006 17:02    Post subject: Add user to your forum ignore list Reply with quote

ne znam ASP, kako ispisujes kad selektiras inace iz tablice?
ovo ti vraca jedan row sa poljem user_count

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Codemaster



Joined: 11 Jul 2006
Posts: 189
Location: Metkovic

PostPosted: 05.10.2006 17:03    Post subject: Add user to your forum ignore list Reply with quote

ok. kužim. hvala

_________________
Let's play!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
wxyzrusmir



Joined: 27 Jun 2005
Posts: 256
Location: Sarajevo

PostPosted: 05.10.2006 20:10    Post subject: Add user to your forum ignore list Reply with quote

zasto ne izbacis samo total records iz recordset-a to ti je najbolje. automatski ce ti prikazati kompletan broj upisanih recorda u tablici to jeste u tvom slucaju koliko usera je registrovano.

ja recimo to koristim na dva sajta za prikaz koliko ima knjiga u online biblioteci.

_________________
ideas are all that you need | www.ideaisall.com
brainstorming magazine | use the brain to get ideas | www.brainstorming.ba
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
:cosmos:



Joined: 12 Sep 2003
Posts: 2098
Location: México

PostPosted: 05.10.2006 20:22    Post subject: Add user to your forum ignore list Reply with quote

to je ok, al mislim da ako ima neku filtraciju, to moze uraditi i bez da stvara novi recordset. a sa totalom ce dobiti sve, ja to zovem suhe id-ove


Code:
SELECT *,  (SELECT COUNT(*) FROM gallery WHERE gallery.galID = galleries.galID) as PicCount  FROM galleries
ORDER BY ID asc


ovdje zanemari 'where' iako je mozes iskoristiti ako zatrbas

a ispis imas sljedeci

Code:
<%=(galleries.Fields.Item("PicCount").Value)%>


galleries je recordset

nadam se da si skuzio
Back to top
View user's profile Send private message Send e-mail Visit poster's website Twitter profile
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 05.10.2006 23:48    Post subject: Add user to your forum ignore list Reply with quote

wxyzrusmir wrote:
zasto ne izbacis samo total records iz recordset-a to ti je najbolje. automatski ce ti prikazati kompletan broj upisanih recorda u tablici to jeste u tvom slucaju koliko usera je registrovano.

ja recimo to koristim na dva sajta za prikaz koliko ima knjiga u online biblioteci.


ok, a sta se desi ako u tablici imas 100 000 ili 1 000 000 zapisa? Oces selectat sve da bi napravio nesto sto SQL ima rijeseno u startu?

@cosmos: hm, to mu da total uz svaki selectani redak, a to mu ne treba

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
sinke



Joined: 02 Oct 2005
Posts: 257
Location: Zagreb

PostPosted: 05.10.2006 23:53    Post subject: Add user to your forum ignore list Reply with quote

Code:
SELECT *

Za to se u zatvor ide!

_________________
THE SHTANZIG | Web Do's & Don'ts
Back to top
View user's profile Send private message Visit poster's website Twitter profile
:cosmos:



Joined: 12 Sep 2003
Posts: 2098
Location: México

PostPosted: 06.10.2006 08:43    Post subject: Add user to your forum ignore list Reply with quote

mastersinke wrote:
Code:
SELECT *

Za to se u zatvor ide!


zasto?
Back to top
View user's profile Send private message Send e-mail Visit poster's website Twitter profile
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 06.10.2006 14:39    Post subject: Add user to your forum ignore list Reply with quote

Još jedno rješenje

Code:

Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT id FROM Tvoja_tablica"
rs.Open strSQL, strConn 1, 3
intBrojZapisa = rs.RecordCount

Response.Write "Ima " & intBrojZapisa & " korisnika."

_________________
Odin's descendant
Back to top
View user's profile Send private message
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 06.10.2006 15:17    Post subject: Add user to your forum ignore list Reply with quote

@zvone: mozes molim te objasniti sto ovo radi? ne znam ASP a zanima me logika iza rjesenja.

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 06.10.2006 15:54    Post subject: Add user to your forum ignore list Reply with quote

Ne znam ni ja ASP ali Zvonko je ovdje selectao sve ID-eve iz baze i onda prebrojio retke Confused

BTW super je kako se povela cijela rasprava a jedino točno rješenje je bilo postano već kao prvi odgovor Smile

Last edited by Sulien on 06.10.2006 16:00; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Codemaster



Joined: 11 Jul 2006
Posts: 189
Location: Metkovic

PostPosted: 06.10.2006 15:56    Post subject: Add user to your forum ignore list Reply with quote

ma sve su to varijacije na temu, ali na kraju krajeva sa svima njima se dobije željeni rezultat

_________________
Let's play!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 06.10.2006 15:59    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
Ne znam ni ja ASP ali Zvonko je ovdje selectao sve ID-eve iz baze i onda prebrojio retke Confused

da i mislio sam da to radi, ali mozda ASP ima neku super naredbu koju ja nekuzim Very Happy Shocked

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 06.10.2006 16:00    Post subject: Add user to your forum ignore list Reply with quote

Codemaster wrote:
ma sve su to varijacije na temu, ali na kraju krajeva sa svima njima se dobije željeni rezultat

isto je kad u tablici imas 100 ili 1000 zapisa, ali probaj tak prebrojat retke u tablici sa 5 000 000 zapisa (ne pricam napamet, radim sa bazom te velicine)

Last edited by retro_one on 06.10.2006 16:04; edited 1 time in total

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 06.10.2006 16:02    Post subject: Add user to your forum ignore list Reply with quote

retro_one wrote:
mozda ASP ima neku super naredbu koju ja nekuzim

Ne. Nema Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 06.10.2006 16:16    Post subject: Add user to your forum ignore list Reply with quote

Može i bez SQL upita.

Code:

Set rsCount = Server.CreateObject("ADODB.Recordset")
rsCount.Open "ime_tablice", strConn, 1, 3

intBrojZapisa = rs.RecordCount
Response.Write "Ima " & intBrojZapisa & " korisnika."

_________________
Odin's descendant
Back to top
View user's profile Send private message
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 06.10.2006 17:09    Post subject: Add user to your forum ignore list Reply with quote

Mislim da je ovo ipak najbolje rješenje:
Code:
Response.Write "<a href='http://www.php.net'>jači</a>, <a href='http://www.ruby-lang.org/en/'>najjači</a>"

(hehe)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 06.10.2006 17:16    Post subject: Add user to your forum ignore list Reply with quote

Ak ćemo već tako onda ASP.NET jači od svih

_________________
Odin's descendant
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 07.10.2006 01:16    Post subject: Add user to your forum ignore list Reply with quote

zvone wrote:
Ak ćemo već tako onda ASP.NET jači od svih

a nije od mog tate.

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
Codemaster



Joined: 11 Jul 2006
Posts: 189
Location: Metkovic

PostPosted: 07.10.2006 10:13    Post subject: Add user to your forum ignore list Reply with quote

zvone wrote:
Ak ćemo već tako onda ASP.NET jači od svih


slažem se, ali nemojmo započinjati još jednu besmislenu raspravu - neka svatko radi u s onim što misli da je bolje Smile

_________________
Let's play!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 07.10.2006 12:48    Post subject: Add user to your forum ignore list Reply with quote

Codemaster wrote:
...neka svatko radi u s onim što misli da je bolje

...dok ne skuži da su skriptni jezici kao PHP/Ruby najbolji - naravno Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 07.10.2006 13:00    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
Codemaster wrote:
...neka svatko radi u s onim što misli da je bolje

...dok ne skuži da su skriptni jezici kao PHP/Ruby najbolji - naravno Smile



Applause Applause

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
Eric



Joined: 27 Jun 2005
Posts: 248
Location: Rijeka on rails

PostPosted: 07.10.2006 13:14    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
Codemaster wrote:
...neka svatko radi u s onim što misli da je bolje

...dok ne skuži da je skriptni jezik Ruby najbolji - naravno Smile


Evo samo mali edit...

_________________
I WRITE BEAUTIFULL CODE, NO MORE, NO LESS.
http://del.icio.us/jardas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group