i'm trying to get rid of a bug ASAP. I'm using mysql_num_rows but it ALWAYS returns 0. And i dont know if it's because i have the wrong syntax or what... can you guys help me? here's the code;
<?php
include_once("checklogin.php");
$u = "";
if(isset($_GET["u"])){
$u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']);
} else {
header("location: http://www.myswesite.com/login.php");
exit();
}
$sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1";
$user_query = mysqli_query($connection, $sql);
$numrows = mysqli_num_rows($user_query);
if($numrows < 1){
echo "User does not exist or is not yet activated, press back";
exit();
}
?>