SQL Statment - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Databases - MySQL, SQL, Oracle, Access and others

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-09-2006, 12:27 PM   #1 (permalink)
Junior Member
 
Join Date: Aug 2006
Posts: 5
Default SQL Statment

Hi.

I am now designing a webpage for my local sports team, and I need some help with an SQL statment.
I have a page where users can view the stats of players. All information is stored in an access database, that is connected and working properly. My current SQL statment is:

SELECT * FROM mydatabase where playerID = 'player1'

and that will display 'Player 1s' records. Doing it this way I have to create a page for every player, and I don't want to do that. I want it so that when I type the address:

profiles.asp?playerID=player2, it will display 'Player 2s' records by modifying my SQL statment to : SELECT * FROM mydatabase where playerID = 'player2'

Then when I type: profiles.asp?playerID=player3, it will display 'Player 3s' records by modifying my SQL statment to: SELECT * FROM mydatabase where playerID = 'player3'

How can I do this. I am pretty sure I will have to request.querystring("playerID") but can't figure it out from there.

Any help?

Thank You.
MIDNIGHTBANDIT9 is offline   Reply With Quote
Sponsored Links
Old 09-09-2006, 12:57 PM   #2 (permalink)
Junior Member
 
Itsacon's Avatar
 
Join Date: Sep 2006
Location: Sector ZZ9 Plural Z Alpha
Posts: 34
Send a message via ICQ to Itsacon
Default Re: SQL Statment

What language is the webpage written in? ASP? PHP? C?
Itsacon is offline   Reply With Quote
Old 09-09-2006, 03:46 PM   #3 (permalink)
Junior Member
 
Join Date: Aug 2006
Posts: 5
Default Re: SQL Statment

Sorry I forgot. This is written in ASP.
MIDNIGHTBANDIT9 is offline   Reply With Quote
Old 09-09-2006, 11:05 PM   #4 (permalink)
Junior Member
 
Itsacon's Avatar
 
Join Date: Sep 2006
Location: Sector ZZ9 Plural Z Alpha
Posts: 34
Send a message via ICQ to Itsacon
Default Re: SQL Statment

Hmm, don't have experience with ASP, so don't know the syntax, but I'll try to explain what you need to do.

the 'request.querystring("playerID")' sounds pretty logical to me, I assume that's the code to request the part from the querystring (GET and POST vars) that's tagged 'playerID'.


Then you need to parse it into the SQL query. Again, I don't know the ASP syntax for string concatenation, but I believe it's the ampersand (&):

Your current code will be something like this:
Code:
SQLquery = "SELECT * FROM mydatabase where playerID = 'player1'";
change it to something like this
Code:
SQLquery = "SELECT * FROM mydatabase where playerID = '" & request.querystring("playerID") & "'";
Again, I'm not proficient in ASP, so I hope this is useful.
Itsacon is offline   Reply With Quote
Old 05-03-2007, 05:52 PM   #5 (permalink)
Junior Member
 
Join Date: May 2007
Posts: 28
Default Re: SQL Statment

What you need to create is a parameteric query. This can be easily done for mroe than one parameter. When you do this you will supply the paramer at run time. If you want you can also web enable using what are called Data Access Pages.

Try the link , All you wanted to know about MS Access at the following link:
Hodentek
Krishnaswamy is offline   Reply With Quote
Old 10-19-2007, 02:41 PM   #6 (permalink)
Junior Member
 
Join Date: Oct 2007
Posts: 3
Default Re: SQL Statment

This is helping Nice work
Monikas is offline   Reply With Quote
Old 11-17-2007, 02:05 PM   #7 (permalink)
Junior Member
 
Join Date: Nov 2007
Posts: 8
Default Re: SQL Statment

Google for "asp database tutorial" found tons of helpful samples

heres one

Connecting To An Access Database Using ASP
websiterepairguys is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:13 AM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting