View Single Post
Old 09-05-2012, 02:16 PM   PM User | #1
DjDanHayden
New Coder

 
DjDanHayden's Avatar
 
Join Date: Nov 2008
Location: Ireland
Posts: 54
Thanks: 18
Thanked 0 Times in 0 Posts
DjDanHayden is an unknown quantity at this point
mod rewrite help

Hi,

I are trying to mod rewrite my profile.php?id=1 to profile/Username


I have this code in my .htaccess


PHP Code:
RewriteEngine on
RewriteBase 
/
RewriteRule ^profile/(.*)$ profile.php?id=$

and this code in my php file profile.php

PHP Code:
$url_parts explode("/"$_GET['url']);
$friendly_name $url_parts[0];
$friendly_name mysql_real_escape_string($friendly_name);
$name $friendly_name;

if(
$name != "" && $name != NULL)
{
  
$result mysql_query("SELECT userid FROM user WHERE username='".$name."'");
  if(
mysql_num_rows($result) > 0)
  {
    
$assoc mysql_fetch_assoc($result);
    
$account $assoc['id'];
  }
  else
  {
    echo
'Does not exist';
  }
}
      
$id == $account


When i try to echo the users $id or even $name it will not echo ?

Can anyone help ?
DjDanHayden is offline   Reply With Quote