Hello All,

I apologize for what seems to be a simple thing to solve but I'm not sure why I can't get the correct result below. Here is the code and the problem:

I'm using .HTACCESS to password protect a directory. I'm taking the username and storing it in a variable so I can match it against my database so it pulls only the information for that user. The problem I'm having is when I statically place the members username in, it draws the correct result (correct answer is 1) but when I insert the variable, it shows 0 (should be 1). Here is the code, please let me know if I'm missing something really simple or if I'm really far off, thanks!

$member = $_SERVER['PHP_AUTH_USER'];
// echo $member;
// Echo works fine; Just to make sure I'm getting a value which in this case is "pp-callshe".

function get_num_total_locations()
 $results = mysql_query("SELECT id from locations WHERE member = '$member'");
// This result returns 0.

// $results = mysql_query("SELECT id from locations WHERE member = 'pp-callshe'");
// This result returns 1 as it should.  The username is dynamically created with a script and placed in my .htaccess file.  When a user logs in, I'm using php_auth_user to find out which one logged in.  Once logged in I need to pull only results for this user.

 return mysql_num_rows($results);

Edited by Dani: Snippet was not in the snippet textarea

7 Years
Discussion Span
Last Post by diafol
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.