Hi i have this error if i send a message to a member on my site

That user does not exist or is not yet activated, press back

Although the member is activated ive also tried other members

here is the code thats sending it like it after installing the script

<?php 
include_once("php_includes/check_login_status.php"); 
// Initialize any variables that the page might echo 
$u = ""; 
$mail = ""; 
// Make sure the _GET username is set, and sanitize it 
if(isset($_GET["u"])){ 
    $u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); 
    } else { 
        header("location: index.php"); 
        exit(); 
} 
// Select the member from the users table 
$sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1"; 
$user_query = mysqli_query($db_conx, $sql); 
// Now make sure that user exists in the table 
$numrows = mysqli_num_rows($user_query); 
if($numrows < 1){ 
    echo "That user does not exist or is not yet activated, press back"; 
    exit(); 
} 
Member Avatar

diafol

Place temporary echo commands at key places to find out where your script is going, e.g.

if(isset($_GET["u"])){ 
$u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); 
echo "GET isset and u value = $u";

} else { 
    header("location: index.php"); 
    exit(); 
} 

Use 'or die()' for mysqli functions