Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 09-09-2006, 12:26 PM SQL Statement
Novice Talker

Posts: 12
Trades: 0
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.

Last edited by MIDNIGHTBANDIT9; 09-09-2006 at 12:31 PM..
MIDNIGHTBANDIT9 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-09-2006, 04:45 PM Re: SQL Statement
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
You have the idea right on track - But I think you will have better response posting your question in ASP forum.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-09-2006, 09:52 PM Re: SQL Statement
Junior Talker

Posts: 3
Name: Renee
Trades: 0
The SQL statement should be written to accept a URL parameter rather than a hard-coded value. For instance:

SELECT * FROM mydatabase where playerID = 'Request.Querystring("PlayerID")'

Last edited by tekgirl6; 09-09-2006 at 10:00 PM..
tekgirl6 is offline
Reply With Quote
View Public Profile
 
Old 09-09-2006, 10:02 PM Re: SQL Statement
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
PHP - Why didn't you say so??

'SELECT * FROM my_table WHERE player_id = "' . addslashes($_GET['playerID']) . '"'

The addslashes() function is used to help prevent sql attacks. You can use a better method mysql_real_escape_string() if you are using PHP >= 4.3.0
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-09-2006, 10:12 PM Re: SQL Statement
Junior Talker

Posts: 3
Name: Renee
Trades: 0
MIDNIGHTBANDIT9vbmenu_register("postmenu_283243", true); is using ASP. Sorry, I'm responsible for this confusion. I thought I was replying to another message when I was talking about using PHP. So, I changed the post. This is my first time on the forum. Sorry.
tekgirl6 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to SQL Statement
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15578 seconds with 12 queries