OutFront Forums
     Home    Register     Search      Help      Login    

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

 

Include record count in Select query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Include record count in Select query
Page: [1]
 
markjlawrence

 

Posts: 119
From: Belfast Northern Ireland
Status: offline

 
Include record count in Select query - 4/21/2001 20:06:00   
Hi,

I have a form that posts its results to a second page where the results are displayed. I would like to display the number of records returned (displayed at the top of the page). I can create this using DRW, however that will mean that 2 connections will be made to the database. Is there any way to incorporate this record count into the SQL query along with the SELECT table.* WHERE .... etc. to make one query return the results and the record count?

Thanks,

Mark.

Spooky

 

Posts: 26630
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Include record count in Select query - 4/21/2001 22:24:00   
The easiest way it to use <%=fp_iCount%> (from memory)

This is a count from the SQL string that exists, but is only available after processing the DRW

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to markjlawrence)
markjlawrence

 

Posts: 119
From: Belfast Northern Ireland
Status: offline

 
RE: Include record count in Select query - 4/22/2001 20:16:00   
Brilliant! That's just what I need!

Thanks Spooky :-)


(in reply to markjlawrence)
Stuart at Cherry

 

Posts: 121
From: Leeds, West Yorkshire, UK
Status: offline

 
RE: Include record count in Select query - 4/25/2001 20:42:00   
Mark,

I've got a recruitment site that pulls up all the vacancies from a database. I too would like to put something at the top such as "There are x vacancies on this search".

I think this is what you were asking, and you seem pleased with the response, but I don't understand.

Where do you put the "<%=fp_iCount%>"?

Thanks in anticipation....


(in reply to markjlawrence)
Mojo

 

Posts: 2454
From: Chicago
Status: offline

 
RE: Include record count in Select query - 4/25/2001 20:10:00   
<%fp_iCount%> only works after the DRW has done its work. You will not be able to have your record number above the actual results.

If that is not a problem then it works great. Another Spooky success!

Joe


(in reply to markjlawrence)
markjlawrence

 

Posts: 119
From: Belfast Northern Ireland
Status: offline

 
RE: Include record count in Select query - 4/25/2001 15:06:00   
Good point jbennett, I haven't got as far as trying it out. I assumed that I could set a variable = to the <%=fp_iCount%> and then display it on the page. Don't ask me about the syntax, I was hoping to pick that up as I go along. If you have figured it out, let me know.

Mark.


(in reply to markjlawrence)
Spooky

 

Posts: 26630
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Include record count in Select query - 4/25/2001 17:43:00   
The fp_icount does not become active until the include page fpdbrgn2 has been read.

So the variable will only be active after that part of the page (which is below the DRW)

So renaming it etc wont work as it will be null.

btw the "=" is shorthand for Response.write if you wanted to know

So the icount is my best suggestion, as I dont like suggesting that another dtabase call is made on the same page, just for a record count.


(in reply to markjlawrence)
jessecan

 

Posts: 109
From: Aliso Viejo, CA
Status: offline

 
RE: Include record count in Select query - 5/15/2001 14:16:00   
Hello,

I would like to use this parameter but do not know where to insert it. Do you put it into the custom query or what. I have tried to put it into the HTML but FP will not let it stay without rewriting it to the way that it was. Can anyone help?

Thank you in advance!


(in reply to markjlawrence)
Mojo

 

Posts: 2454
From: Chicago
Status: offline

 
RE: Include record count in Select query - 5/15/2001 20:44:00   
On your DRW page... It has to go after the DRW and before the end of the grey code.

This is what we were talking about in the above posts. You will not be able to have the record count displayed at the top of the page using this method. Other than that, it works great.

Joe


(in reply to markjlawrence)
jessecan

 

Posts: 109
From: Aliso Viejo, CA
Status: offline

 
RE: Include record count in Select query - 5/16/2001 20:22:00   
Joe,

I still cannot figure out where to insert this script. I have tried inserting it everywhere after the red code and before the end of the grey code. When I do insert it in a place that FP will let it be, it results in an error when I try and run it. Can anyone lend me further assistance?


(in reply to markjlawrence)
Spooky

 

Posts: 26630
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Include record count in Select query - 5/16/2001 20:35:00   
Try (in HTML view)
placing the code just before the closing body tag:

<%=fp_iCount%>
</body>
</html>

Make sure though, that you cut and paste this into notepad first, then in to frontpage


(in reply to markjlawrence)
Dealer58

 

Posts: 173
From: New York (was in Germany)
Status: offline

 
RE: Include record count in Select query - 6/12/2001 18:51:00   
Hi Gang

I also have the <%=fp_iCount%> toward the end of the page. It gives me the count as well. However, I have the DRW set to return only 25 rows at a time. If there are 100 rows returned in total it only shows a count of 25 each time!!

So...that is not the actual count of the query. I guess the only way to get an actual count with this method is to return the entire search on one page. What if you have a couple of thousand rows of fields to return? The user would be scrolling all the way down to(well, you know where!)

I just found another count method on this site (I didn't see this before, maybe I missed it) It looks like Spooky's handwork and if I'm not mistaken this count is taking place before the fpdbrgn2 has been read. I haven't tried it yet but is this returning the same type of count requested in this thread?

Here's what I'd like to do. First of all I would also like to return the entire query count before the DRW. I am not looking to return every item in the table, only the ones the search finds.

I stumbled on a website that was built with FP. He has the query count the way I just explained it. I cannot see how he did it but maybe Spooky can see through this.

I do not have the link right in front of me now. Spooky, I'll get it some how in the next 8-10 hours and email it to you. (I'm on the road right now using Hotel PC's)

Regards
CC


(in reply to markjlawrence)
Dealer58

 

Posts: 173
From: New York (was in Germany)
Status: offline

 
RE: Include record count in Select query - 6/14/2001 20:35:00   
Here's the link. What do you think?

http://www.bflea.com/pages/Script/SearchForCat.asp?cat=205

CC


(in reply to markjlawrence)
Spooky

 

Posts: 26630
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Include record count in Select query - 6/14/2001 20:46:00   
How do you know they used the DRW?

(in reply to markjlawrence)
Dealer58

 

Posts: 173
From: New York (was in Germany)
Status: offline

 
RE: Include record count in Select query - 6/14/2001 20:22:00   
Spooky,

The reason why I think its a DRW is because if you look at the source it is has FrontPage criteria all over it. I'm sure the site is based on Front Page.

Furthermore, looking a the source, it has

<!--webbot bot="HTMLMarkup" startspan -->

<!--webbot bot="HTMLMarkup" endspan -->

all over it. From my amatuer point of view (and I could be wrong) this tells me that it is a DRW and its not even on a diet. Because it looks similar to one of my pages that has a DRW looking at the source

(Was this a test? Did I pass?)

CC


(in reply to markjlawrence)
Mojo

 

Posts: 2454
From: Chicago
Status: offline

 
RE: Include record count in Select query - 6/14/2001 20:55:00   
After looking through that page I don't see how you can tell it is using the DRW.

In fact I am sure they are *NOT* using the DRW.

Look:
<INPUT TYPE="HIDDEN" NAME="nextCatNo" VALUE="205">
<INPUT TYPE="HIDDEN" NAME="nextTitle" VALUE="">
<INPUT TYPE="HIDDEN" NAME="total" VALUE="35">
<INPUT TYPE="HIDDEN" NAME="Cat" VALUE="205">
<INPUT TYPE="HIDDEN" NAME="currentPage" VALUE="1">

They are passing the page number, total items found and other information through hidden fields in the form. This is how they are maintianing state. FP does not do it like this.

Heck, they are passing the SQL query string through hidden fields. If you go further, you will see they are passing everything, even the *PRICE* through hidden fields.

This is a custom job. It looks like an out of the box ecommerse package. If they are not doing an HTTP_REFERER check on their site you may be able to buy everything for a $1... or less. They could get spoofed and the REFERER check may not even matter.

Joe


(in reply to markjlawrence)
Spooky

 

Posts: 26630
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Include record count in Select query - 6/14/2001 16:36:00   
I wasnt going to go there

(in reply to markjlawrence)
Dealer58

 

Posts: 173
From: New York (was in Germany)
Status: offline

 
RE: Include record count in Select query - 6/14/2001 18:58:00   
This is why I like this place!

I think you guys are the BEST there is. Honestly. Everything cut, dry and to the point.

Like I said, I'm an amature. I am learning here, perhaps by hitting and missing, but in the end the most important thing prevails.

I'm learning how to get things done the right way. About 4 months ago I didn't even know what <html> meant!

Thanks Again

CC

PS I think this is the 3rd or 4th thread I've burned. Sorry!


(in reply to markjlawrence)
hzarabet

 

Posts: 1598
From: New Milford CT USA
Status: offline

 
RE: Include record count in Select query - 6/15/2001 20:54:00   
I am just skimming this thread so I may have missed the obvious, but I run a count on my database results page. I just set up a second DRW using COUNT and then put it on a diet.

http://www.signingshotline.com/search.asp

Fill in a search and you'll see.

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada


(in reply to markjlawrence)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Include record count in Select query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts