function returnnotify(){

        $result = mysql_query("SELECT * FROM rentcustomer WHERE Expiredtime = CURDATE()");

        $count = mysql_num_rows($result);

        if ($count >= 1){

        echo $count;    
        }else{
            echo "0";
        }
}

now when I run the code above ,it will prompt out this error:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\include\functions.php on line 6

Can I know where's the error?

The query work fine in phpmyadmin, it can search the result that I expected.

Your query failed. Do this:

$result = mysql_query("SELECT * FROM rentcustomer WHERE Expiredtime = CURDATE()")
    or die(mysql_error());
<?php
echo "<h1>Register</h1>";
$submit = @$_POST['submit'];
$fullname = strip_tags (@$_POST['fullname']);
$username = strip_tags (@$_POST["username"]);
$password = strip_tags (@$_POST['password']);
$repeatpassword = strip_tags (@$_POST['repeatpassword']);
$date = ("Y-m-d");
if ($submit)
{
//check for existence
if ($fullname&&$username&&$password&&$repeatpassword)
{
if ($password==$repeatpassword)
{
//check char length of username and fullname
if (strlen($username)>25||strlen ($fullname)>25)
{
echo ("Length of username or fullname is too long!");
}
else
{
// check password length
if (strlen($password)>25||strlen ($password)<6)
{
echo ("Password must be betwwen  6 and 25 characters");
}
else
{
//register the user!
echo ("Success!!");
}
// encrypt password
$password = md5 ($password);
$repeatpassword = md5 ($repeatpassword);
// open database
$connect = mysql_connect ("localhost","root","");
mysql_select_db ("phplogin"); //select database
$queryreg = mysql_query ("
INSERT INTO users VALUES ('','$username','$password','$date','$fullnaname')
");
die ("You have been registered! <a href='index.php'>Return to login page</a>");

 }

}

}
else 
    echo ("Your passwords do not match!");
}
else
    echo ("Please fill in<b>all</b>fields!");
// register the user!
echo ("Success!");
else

echo("Your password do not match!");
}
else
echo $username."<br>".$fullname;
}
?>

it show me this:
Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp\htdocs\site 2\register.php on line 64

<?php
$submit = @$_POST['submit'];
//form data
$fullname = strip_tags (@$_POST['fullname']);
$username = strip_tags (@$_POST['username']);
$password= strip_tags(@$_POST['password']);
$repeatpassword = strip_tags(@$_POST['repeatpassword']);
$date =("Y-m-d");
if ($submit);
{
// check for existance
if($fullname&&$username&&$password&&$repeatpassword)
{
//encrypt password
$password = md5 ($password);
$repeatpassword =md5 ($repeatpassword);

if ($password==$repeatpassword)
{
// check char length of username and fullname
if (strlen($username)>25||strlen($fullname)>25)
{
echo ("Length of username or fullname is too long");
}
else
{
//check password length
if (strlen($password)>25|| strlen($password)<6)
{
 echo ("Password mus be betwen 6 and 25 characters");
}
else
{
//register the user!!
echo ("Success!!");
}

}
else
 echo ("Your password do not match");
}
else
echo("Please fill in <b>all</b> fields!");
}


?>

that code show me this:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\site 2\register.php on line 58

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.