Hi guys,
I`m learning PHP with MySQL and have some problem.
I`m just creating a simple script to accept login details from index.php and transfer them to login.php via POST. 1st part went smooth. For 2nd part, login.php I`m having some problem.
I tried google and change the variable names too but the result was same. I kept getting error:
My login.php is here:
Can anyone help me ?
I`m learning PHP with MySQL and have some problem.
I`m just creating a simple script to accept login details from index.php and transfer them to login.php via POST. 1st part went smooth. For 2nd part, login.php I`m having some problem.
I tried google and change the variable names too but the result was same. I kept getting error:
Code:
[SIZE=1]Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\login.php on line [I]10[/I][/SIZE]
My login.php is here:
PHP:
<?php
$con= mysql_connect("localhost","usermaster","") or die (mysql_error());
$cName= $_POST["boxuser"];
$cPass=$_POST["boxpass"];
mysql_select_db("mynewdb");
//$data = "select * from mytable where uname=".$cName."and upass=".$cPass;
$query = "SELECT * FROM mytable";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ((strlen($row))>0)
{
echo "Login successful.";
}
else
{
echo "Login failed.";
}
mysql_close();
?>
Can anyone help me ?