You have to do the connection first, as you have further down in the code:
//connection.php file
$con= mysqli_connect($server,$username,$password,$db);
Then after that is done, do your mysqli_query()
. So, you might want to do all the connection stuff first, starting at that line and the if/else check to make sure you are successfully connected, then do the query and check the result:
$con= mysqli_connect($server,$username,$password,$db);
if($con)
{
$insertquery = "INSERT INTO jobregistration (id, firstname, lastname, mobile, email, city, jobpost) VALUES (1, 'akgjkl', 'andkfj', '70108347', 'hfkajh@gmial.com', 'chennai', 'webd') ";
$res = mysqli_query($con,$insertquery);
if($res)
{
?>
<script>
alert("data inserted successfully");
</script>
<?php
}
else{
?>
<script>
alert("data not inserted ");
</script>
<?php
}
}
else
{
echo "NO CONNECTION";
}
Untested, so may be typos/mistakes.