Jump to content

Simple help with my .htaccess file


twebman84

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.