Well, whenever I try to run a user verify script, that asks SQL if a username is not taken, I always get this response...

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in dir/userver.inc on line 11
count unavailable

this is the code in general:

<?php
//User Name Verify

function userver($userveri)
{

    $query = "SELECT 'username' FROM 'users' WHERE 'username'='$userver1'";

    $sql = mysql_query($query);

    $nrows = mysql_num_rows($sql) or die("count unavailable");



    if($nrows != 0)
    {
    echo "The username you have chosen already exists!";
    die();
    } 
    else 
    {
    return($userveri);
    }

}
?>

Anyone have some ideas? I really need this function for the user database to function correctly. Help is appreciated.

The problem is not with your num_rows line it is with your query line. The variable name you search with does not match the variable name you passed to the function.

variable passed to function is --> $userveri
Varibale passed to the query --> $userver1

Change the 1 to an i and this should work for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.