Forum Moderators: open

Message Too Old, No Replies

Asp

Include certain info from database on front page

         

donnalorr

6:00 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



I'm a beginner at ASP, and need some help with an issue: I have a script that allows press releases to be shown on this page -- <snip>

I need to include the top 5 releases on this page - "where it says Press releases on the right" <snip> -- I know I can do a file include, but of course, it doesn't work with the asp query.

Anyone know how to accomplish this? Remember, I am not that advanced in ASP

Many thanks!

[edited by: Woz at 10:58 pm (utc) on April 19, 2006]
[edit reason] No URLs please, see TOS#13 [/edit]

ebound

6:16 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



How is the script that you are using on the first page generating the press release data? I assume you are querying a database? If so, you should be able to run the same scripting on the default page. You may have to adjust your query to ask for the top 5 records only, but that should be about it.

donnalorr

6:46 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Actually, here is what I should have posted to make it clearer: I want the content of this page: <snip>

to show up on this page - <snip> where it says "need top 5 press releases to show up here"

I've solved sorting out the 5. I know that the asp?catid=21 select doesn't work using a file include...how do I make it work..?

Thanks!

[edited by: Woz at 10:59 pm (utc) on April 19, 2006]

ebound

7:21 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



I am assuming that you are using some sort of content management system or code that someone else has written.

Getting the top five news releases is really as simple as querying your database and looping through the records on your default page. Do you know how to do this?

If you want to use an include file, you do not have to pass the variables through a querystring. You can hard code the variables that would be passed at the top of the code in your include file. Your variables shouldn't change for what you need them for.

donnalorr

7:28 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Hey thanks for the help..Again, I don't need to know how to do the 5 anymore.

What my real question is is

How do I make including the file in that section of the defaulttest.asp page work? If you do the include file code using the query string, I know that doesn't work. How do I make it work?

donnalorr

7:29 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



In other words, I don't know what the last part of your message means because I am new to asp..Can you give me an example? thanks

ebound

7:46 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Its hard to say what to do without seeing your code. There could be alot of things going on within your code. If you insist on using the category_view.asp script as an include rather than looping through your own sql call then here is what I suggest. Keep in mind this may cause errors due to things such as redundant variable declarations, db connnections, etc.

Make a copy of file <snip> and name it NewsInclude.asp or whatever. At the top of this page add the following line of code:

catid=21

This will hard code the variable you were originally passing through the query string. If no errors are generated from possible issues mentioned earlier, this should allow you to use the file as a include.

You can now call the include file without a querystring:
<!-- #include file="NewsInclude.asp" -->

I also suggest you review some very basic ASP principles. These websites will help.

[w3schools.com...]
[4guysfromrolla.com...]
[asp101.com...]

[edited by: Woz at 11:00 pm (utc) on April 19, 2006]