PDA

View Full Version : Path_info



blm126
10-28-2005, 02:23 AM
I have a site where all I have is one page that access a database for all the page content.The code I wrote worked great with GET variables.I recently decided I wanted to make the address look better.Instead of www.domain.com/site.php?page=home I wanted them to look like www.domain.com/site/home.I figured out how to use the $PATH_INFO but something isn't working quite right.I don't get a pare error but nothing shows up but the template.Here is the code so far.



//address like www.mydomain.com/site/home
$var_array = explode("/",$PATH_INFO);
$grabpage = $var_array[2];
$id = $grabpage;
mysql_select_db($database_database, $database);
$query_site = "SELECT * FROM site where id = '$id'";
$site = mysql_query($query_site, $database) or die(mysql_error());
$row_site = mysql_fetch_assoc($site);
Any help getting this to work is appreciated.