Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Databases - MySQL, SQL, Oracle, Access and others
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-09-2006, 12:27 PM   #1 (permalink)
MIDNIGHTBANDIT9
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)
Itsacon
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?
__________________
"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams
Itsacon is offline   Reply With Quote
Old 09-09-2006, 03:46 PM   #3 (permalink)
MIDNIGHTBANDIT9
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)
Itsacon
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.
__________________
"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams
Itsacon is offline   Reply With Quote
Old 05-03-2007, 05:52 PM   #5 (permalink)
Krishnaswamy
Junior Member
 
Join Date: May 2007
Posts: 29
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)
Monikas
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)
websiterepairguys
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
__________________
Visit www.websiterepairguys.com for your website maintenance needs.
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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» 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 11:42 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums