when insert data in a inbox and when it compare with mysql data with it will show error message. my dbcon.php file is
<?php
define('DB_server','localhost');
define('DB_user','root');
define('DB_pass','');
define('DB_Name','dbtuts');
class DB_con
{
function __construct()
{
$con=mysql_connect(DB_server,DB_user,DB_pass) or die('connection problem'.mysql_error());
mysql_select_db(DB_Name,$con);
}
public function comp($lnum)
{
$res = "SELECT * FROM users WHERE l_num= '".$_GET["$lnum"]."'";
return $res;
}
}
?>
here database table values f_num,l_num,sum and my compare.php file is
<?php
include_once 'dbcon.php';
$con=new DB_con();
if(isset($_POST['log']))
{
$lnum=$_POST['li_num'];
$res=$con->comp($lnum);
if($res){
while($row = mysql_fetch_array($res)) {
$num=$row['li_num'];
?>
<script>
alert("thnks for login")
</script>
<?php
}
}
}
?>
<html>
<head>
<title>Enter customer value</title>
</head>
<body>
<center>
<form method="POST">
<table align="center">
<tr>
<td><input type="text" name="fi_num" placeholder="enter value" required> name</td>
</tr>
<tr>
<td><input type="text" name="li_num" placeholder="enter extra"> password</td>
</tr>
<tr>
<td><input type="text" name="sum" placeholder="enter sum"> sum</td>
</tr>
<tr>
<td><button type="submit" name="log">login</button></td>
</tr>
</table>
</form>
</center>
</body>
</html>
when i click login button two errors coming
Notice: Undefined index in dbcon.php and
Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in compare.php
any suggestion for this problem.it will help to me