Jump to content

Recommended Posts

I have a page that is designed to query a baseball database and pull the stats for a specific player based on the URL. Here's the code that my question pertains to:

 

//Break URL Up into an array, each element is the text between each /
$urlParts = explode('/', $_SERVER[REQUEST_URI]);

//Extract player code from URL by selecting the last element
$aPlayer = $urlParts[count($urlParts)-1];

//Deal with a trailing slash on the URL
if($aPlayer=='')
$aPlayer = $urlParts[count($urlParts)-2];

//Connect to Database
require('mysql_con.php');

//Query to retrieve bio info for this player
$getPlayerInfo = "SELECT playerID, nameFirst, nameLast, nameGiven, birthMonth, birthDay, birthYear, birthCity,
			  birthState, debutMonth, debutDay, debutYear, bats, throws, height, weight, nameNick,
			  deathMonth, deathDay, deathYear, deathCity, deathState, photo
			  FROM TBP_Master
			  WHERE playerID = '$aPlayer';";

//Run Query
$playerInfo = mysql_query($getPlayerInfo);

 

And so on...

 

The problem is that there apparently needs to be an entry in my .htaccess file to allow this to work.  The URL should end up like this:  http://www.thebaseballpage.com/players/stats/PLAYERID (the variable)

 

'stats' is the name of the file that contains this code.

 

This all worked fine before I lost my old .htaccess file, so I know the code is good.

 

Does anyone know what needs to be in my .htaccess file?

Link to comment
https://forums.phpfreaks.com/topic/157108-simple-help-with-my-htaccess-file/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.