Thank,
I've found my answer and i explain it:
first,i use:
var_dump($query);
and second, i use:
or die(mysql_error().": $query"
it's like
$allRows=mysql_query($query)or die(mysql_error().": $query");
now,it's my right code now:
session_start();
$user = $_POST['txtuser'];
$pass = $_POST['txtpassword'];
$con=mysql_connect('localhost','root','');
if(!$con)
{
echo "Connection is Failed!!";
exit;
}
mysql_select_db('newsdb',$con);
$query="SELECT * FROM users WHERE username='$user' AND password='$pass'";
var_dump($query);
$allRows=mysql_query($query)or die(mysql_error().": $query");
if(!$allRows)
{
echo "Query Not Executed!!";
exit;
}
echo $allRows;
$numRows=mysql_num_rows($allRows);
if($numRows)
{
$_SESSION['user']=$user;
echo "<center>Welcome ".$_SESSION['user']." to your site<br>";
echo "<a href=user.php>Please click here on this link to load your page</a></center>";
}
Well,i use this codes and i found my problem and then i solved it.
Thanks again.