This code works fine as shown, echoing the $member_id value to the screen, and then running the following query. Notice, though, that the member_id in the SQL statement is hard coded as 1.
When I change the SQL to say member_id = ‘$member_id’ , which is how I want it to work, the query returns no rows and the die statement is executed.
However, as I said, I know the $member_id variable is valid because it is printing correctly to the screen (member 64, in my test case).
And I know the SQL statement works just fine when hard coded with 1 in it.
Ideas?
global $TMPL, $DB, $REGX;
$member_id = $TMPL->fetch_param('member');
$name = $TMPL->fetch_param('name');
$type = $TMPL->fetch_param('type');
if (!$member_id) {
die('no member_id');
}
if (!$name) {
die('no name');
}
$this->return_data .= $member_id;
//Get the user's information from the members table
$query = $DB->query("Select username, screen_name, email from exp_members where member_id = '1'");
if ($query->num_rows == 0) {
//does this member_id exist? This is weird...
die('no member ID');
} else {
$username = $query->row['username'];
$screen_name = $query->row['screen_name'];
$email = $query->row['email'];
}
