Closed Thread Icon

Topic awaiting preservation: ASP - theory more than anything else... Pages that link to <a href="https://ozoneasylum.com/backlink?for=12460" title="Pages that link to Topic awaiting preservation: ASP - theory more than anything else..." rel="nofollow" >Topic awaiting preservation: ASP - theory more than anything else...\

 
Author Thread
sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-04-2002 15:22

I have created an "online document store" for the office. Certain folks upload docs with details, and others download them should they need to.

Ok, I have 2 tables in my database - "docsinfo" and "categories"

docsinfo looks kind of like this:

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
ID

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 10-04-2002 16:19

Umm... why do you even need the categories table? Can't you just to a select * from the docsinfo table and grab the different catogries from there?

Maybe setting the categories field to an integer and using a simple system like 1 = Tender, 2 = Ad Hoc, 3 = Council or whatever your catogries are. The converting from number to category could all be handled in ASP. Then you can also sort the select * from query by catagory and print out the links as you go since they'll already be grouped.

sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-04-2002 16:52

I need a categories table in order to be able to add to the available categories...

So, example:

I'm about to upload a .doc about football, but no sports section, only "news" "features" "weather", so I first go to "add category" form, and enter 'sports' into the categories table. Then when it comes to uploading the document, I select "sports" from the category drop-down.

I think I need this table...

However I'm *sure* you're right about not needing that table for the listing on the main page...

but then: select * from table where category equals *what?*

How does my script know what *what* is going to be if users can add entries themselves?

argh.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 10-04-2002 21:49

You can do this with the sequel itself -

I forget the syntax, but look at the count clause for the group by function - http://www.mysql.com/doc/en/Group_by_functions.html

(You didn't specify what type of DB, but...)



sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-06-2002 00:18

DL-44,

This sounds like good news to me - looks like a relatively simple solution - first a confession:

My ASP is being generated courtesy of DW Ultradev - its really useful, and I find myself "tweaking" code regularly, so I suppose I'm learning, but I'm still pretty dependant on its major functions.

It makes creating Recordsets really easy - including the SQL involved. So I haven't really messed about with that before. Ultradev allows you to put in custom SQL statements, so its learning time for me.

Your link looks invaluable - but a quick question -

Is the code used for MYSQL the same as SQL code in a db-connection script in ASP? No syntax differences?

cheers,

Pete

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-06-2002 00:53

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Sash
Paranoid (IV) Inmate

From: Canada, Toronto
Insane since: May 2000

posted posted 10-06-2002 04:57

Suppose you already opened a connection to your database and called it myConn.
Suppose you set a recordset and called it RS.
Adding something like this in your categories loop should work:

code:
' Second query for counting of documents
Dim SQL_query2, RS2, temp_count
SQL_query2 = "SELECT count(*) as rowCount FROM docsinfo WHERE category = '" & RS("category") & "';"
Set RS2 = myConn.Execute(SQL_query2)
While Not RS2.EOF
temp_count = RS2("rowCount")
RS2.MoveNext
Wend



temp_count is a number of rows variable.

Sasha »

sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-07-2002 10:10

Tried working this into my code last night.. no joy.

I'll give it a fresh look-at today..

thanks Sash,

Pete

Sash
Paranoid (IV) Inmate

From: Canada, Toronto
Insane since: May 2000

posted posted 10-08-2002 04:15

sonicsnail, post a piece of code you use here to loop through your records and we will try to help you.

Sasha »

JMJimmy
Bipolar (III) Inmate

From: Picton, Ontario, Canada
Insane since: Apr 2001

posted posted 10-10-2002 17:05

ASP Theory: Don't use it - even Micro$oft abandoned it.

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 10-11-2002 11:31

Dreamweaver has this fuctionality built in sonicsnail

1 Place the insertion point where you want the counter to appear.
2 Choose Insert > Live Objects > Recordset Navigation Status.
3 Make sure your Results recordset is selected.
4 Click OK

There you have it:

Format = " Record X to Y of Z " (You can edit this to just show Z)

{Edit}Changed Format Display{/Edit}


[This message has been edited by Dufty (edited 10-11-2002).]

sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-11-2002 12:05

Dufty,

That sounds great, however I can't pre-create the recordset for the totals (ie. "get all where category = category1") as I don't necessarily know what all the category names will be as they can be created by the user...

Pete

« BackwardsOnwards »

Show Forum Drop Down Menu