473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Query strings

Hi, I'm Drew and I'm new here; and I could really use some help. I have a website in which I took offline because I found another host that will provide me with more space at a cheaper price. Before I temporarly took it offline to change domains, I decided I want to revamp the whole site, new layout, etc. Now I'll get to the question at hand. My website provides things such as news, sports, weather alot of stuff including a subdomain that features video sharing like Youtube. When I did my website in the past I used plain HTML, which is ok, but I've been using it for way to long and really want to change the method. I have rebuilt part of the site thus far using ASP, and with this ASP instead of having it like before, I.E. creating every page separtly, I want to have one page for every category. For example, when you go to your local network affiliate website their URLs look like this, theirsite.com/Global/Story.asp?S= or thiersite.com/Global/Category.asp?C= I want to do my site the same way, except without the /Global/ seperation. So for instance say you would come to my website and see a story about Bob eating a hamburger and that story was of some interest to you so you click on it and it would take you to Story.asp, then display the story you wanted and it would be displayed like this in the url mysite.com/story.asp?s=random numbers instead of using the method I've used before which would of looked like this mysite.com/news/bob_eating_a_hamburger.html

My question is, how do I go about doing this? I know how to create the main pages, I.E. story.asp, category.asp, etc. I just don't know how to get the stories, etc to diplay on the main pages. I'm using ASP and an access database.

I hope I haven't confused anyone, cause I think I just confused myself a little more. :-) Whatever help can be provided I will be so thankful with! I've looked everywhere and have asked on different forums, but no one answers. I have basic knowledge in ASP, PHP, HTML, HTM, and XML. So I really want to learn how to do this and advance a little more.

Thanks so much in advance!
Aug 5 '07 #1
3 1369
ilearneditonline
130 Expert 100+
My question is, how do I go about doing this? I know how to create the main pages, I.E. story.asp, category.asp, etc. I just don't know how to get the stories, etc to diplay on the main pages. I'm using ASP and an access database.
So let's start with the main page where you would be pulling from the database. I would suggest thinking about using a different db though, access isn't good for much of anything to complicated.

So on your main page you would have a link like...
[HTML] <a href="mysite.com/story.asp?s=1232345">The Story</a>[/HTML]

When clicked, this would take you to story.asp...
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim storyid
  3. Dim rs, db, query ' variables for db connection, recordset, and querystring 
  4. ' s represents the query string parameter
  5. storyid = Request.QueryString("s")
  6.  
  7. query = "SELECT storyid, storytitle, storydetails FROM t_stories WHERE storyid=" & s
  8. db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;"
  9. Set rs = Server.CreateObject("ADODB.Recordset")
  10.  
  11. rs.ActiveConnection = db
  12. rs.Source = query
  13. rs.CursorType = 0
  14. rs.CursorLocation = 2
  15. rs.LockType = 1
  16. rs.Open()
  17. %>
Hope that is enough to get you started.
Aug 5 '07 #2
Thank you so much! I have one last question, then I should be set.

How do I save the stories, in .txt files, regular HTM format, or do I write them in a table in the database? If I do write them in a text file and or HTM format, do I then create a table in the database that links to it so it then will open and display in the appropriate place?

Thanks again!
Aug 6 '07 #3
ilearneditonline
130 Expert 100+
Thank you so much! I have one last question, then I should be set.

How do I save the stories, in .txt files, regular HTM format, or do I write them in a table in the database? If I do write them in a text file and or HTM format, do I then create a table in the database that links to it so it then will open and display in the appropriate place?

Thanks again!
My example suggests that you are saving it to a database. You could check out the w3school tuturial on ADO. It has everything you need to write the code. I wouldn't use .txt or html files. You should also look into doing some caching to speed up your site.
Aug 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: theboss3 | last post by:
I am having trouble with accessing files with query strings. For example the code "require 'template.php?102932'" gives the following error: Warning: main(/www/blog/template.php?102932):...
4
by: Alistair | last post by:
I should just get a hat with a big D on it and then everyone would recognise me.. anyway... I have a DB full of people and their details.. I'm trying to perform a query based on age. so...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
2
by: Oliver Block | last post by:
Hello, sometimes one can see that on some site there are query strings appended to a URL even if the requested document is of .html form. What sense does that make? I couldn't find anything in...
30
by: Paul H | last post by:
I seem to end up with loads of append and update queries just because it's quick and easy to build queries or make a new ones based on an existing query. But I end up with loads of queries with...
12
by: zwasdl | last post by:
Hi, I'm using MS Access to query against Oracle DB via ODBC. Is it possible to use HINT in Access? Thanks, Wei
13
by: john | last post by:
I have table User-App and table App Profile User-App App Profile IDuser IDApp IDApp 1 34 34 1 45 45 2 34 2 45 2 90 3 34
3
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was...
17
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script...
5
by: Just_a_fan | last post by:
I tried to put an "on error" statement in a routine and got the message that I cannot user "on error" and a lamda or query expression in the same routine. Help does not list anything useful for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.