I'm getting an error on line 16 . please help me figure out why this line is giving an error. The code is bellow Non-unique email does not insert into table, so I don't understand the error.
<?php
if (isset($_POST['submit']))
{
$conn=mysql_connect("localhost","root","");
if($conn)
{
$sql=mysql_select_db("user",$conn)
or die("database not found".mysql_error());
$fname=$_POST['firstname'];
$lname=$_POST['lastname'];
$email=$_POST['email'];
$age=$_POST['age'];
$check=mysql_query("select email from reg where email = '$email'");
if(!$check) // if email not insert before then insert new value into database
{
$insert="insert into reg values ('','$fname','$lname','$email','$age') ";
$result= mysql_query($insert);
if($result)
{
echo "thank you for information entered";
}
}
else echo "this email already exist !" ;
}
else
die("server not found".mysql_error());
}