tags:

views:

37

answers:

2

i have written a code in .htaccess

RewriteEngine on
RewriteRule ^category-search/(.*)$ category-search.php?cat_id=$1

and my current URL is

www.mydomain.com/category-search/=NA==

Last values (=NA==) is encoded in base64_encode. But when i m trying to fetch this values in php like...

$val=mysql_real_escape_string(base64_decode($_REQUEST['cat_id']));

I am getting $val equal to nothing. What is error behind this ?

When i was not rewrite in htaccess this was working well.

A: 

shouldn't you be looking at $_REQUEST['cat_id'] instead of $_REQUEST['sub_cat_id'] as that is what you have called the request parameter in the .htaccess file...

Jon
sorry this is perfect code insted of above.. $val=mysql_real_escape_string(base64_decode($_REQUEST['cat_id']));
Ajay
@Ajay: If you want to edit your question, click the "edit" link...
Piskvor
+1  A: 

=NA== is not a valid base64-encoded string (wrong length and invalid character at the beginning). Did you mean NA64==? That decodes to 4.

In case of =NA==, base64_decode() would return false, which outputs as empty string.

Piskvor
oh.. what a blonder i had. thanks.Now this is working.
Ajay
@Ajay: You're welcome. (btw, if an answer solved your problem, tick its checkmark (on the left) to mark it as accepted)
Piskvor