How can I solve this error?
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''user','pass') VALUES('','')' at line 1
<?php
$con = mysql_connect('localhost','root','') or die ('can not connect to server'.$conn->connect_error);
if($con)
{
mysql_select_db('mydb',$con) or die ('can not seletc the database'.$conn->connect_error);
}
$error ='';
if(isset($_POST['login']))
{
$username = $_POST['username'];
$password = $_POST['password'];
mysql_query("INSERT INTO tblogin('username','password') VALUES('$username','$password')");
$id = mysql_insert_id();
if($id > 0)
{
$error .= "Register Successfully";
}
else
{
$error.="Fail To Register<br>".mysql_error();
}
}
?>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
</head>
<body>
<div class="row">
<div class="col-md-5"></div>
<div class="col-md-6">
<form action="" method="post">
<h2>POS Register</h2>
<h5 style="color: red;"> <?php if(isset($error)){echo $error;} ?> </h5>
<table>
<tr>
<td>
<label>User Name</label>
<input type="text" name="username" class="form-control">
</td>
</tr>
<tr>
<td>
<label>Password</label>
<input type="password" name="password" class="form-control">
</td>
</tr>
<tr>
<td>
<input type="submit" name="login" class="btn btn-primary" value="Register">
<a href="login.php">Back To Login</a>
</td>
</tr>
</table>
</form>
</div>
<div class="col-md-3"></div>
</div>
</body>
</html>