0
if($username&&$password)
{
$connect = mysql_connect("localhost","root","") or ("Couldn't connect!");
mysql_select_db("phplogin") or die ("Couldn't find db");
$query = mysql_query("Select * FROM users WHERE username='$username'");
$numrow= mysql_num_rows($query);




i just wont to know the IF statement when it stars what is his function in the code.
4
Contributors
6
Replies
8
Views
4 Years
Discussion Span
Last Post by diafol
0

The is no user-defined function in your code. To which function are you referring?
Are the $username and $password variables set? If not, you may get an error with the straight boolean test. Test for the existence before testing for content:

if(isset($username) && isset($password) && $username && $password){
    ...
}

OR use empty() - note !empty() is the positive test

if(!empty($username) && !empty($password)){
...
}
0

:) i just wont to know how the IF works the if($username&&$password) they are createt in another page this is a login logout,im traying to understand that code.can you explain what this mean if($username&&$password).

-2

hey is somebody there im waiting for help

Votes + Comments
Oh, well everyone should just stop their lives and answer you.
1

hey is somebody there im waiting for help

I thought I answered your question. :(
Pritaeas has clarified, I hope that's enough for you.
Please mark as solved if it is.

Votes + Comments
thnx very helpful your info ; )
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.