i am doing this assignment i have this error. this is a webpage and right now am using php. when i ran the register a page i get this error
Error inserting values into database
i have search hi and low within the code to find the error and for the of me cyh find it. may another pair of eyes will help please and can u tell me what is wrong, where is the error and how it can be fix because something is blocking it. here is my code.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
if(isset($_POST['register_user']))
{
//capture the variable from the form and store in php variables
$title=$_POST['title'];
$fullname=$_POST['fullname'];
$lastname=$_POST['lastname'];
$screenname=$_POST['screenname'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$address=$_POST['address'];
$mypwd=$_POST['mypwd'];
//connecting to the server
include'db_server.php';
$conn = mysqli_connect($db_host,$db_user,$db_pass) or die (mysqli_connect_error());
//select the database you want to query
mysqli_select_db($conn, 'national_wonders') or die (mysqli_error($conn));
$sql = "SELECT * FROM members WHERE screenname='$screenname'";
$result= mysqli_query($conn, $sql) or die ("ERROR:" .mysqli_error());
$rowcount=mysqli_num_rows($result);
if($rowcount >= 1)
{
echo"<script type=\"text/javascript\">
alert('Username already exits!!');
window.location=\"../php/welcome.php\";
</script>";
}
else
{
//insert data into table
$sql = "INSERT INTO members
VALUES('$title', '$fullname', '$lastname', '$screenname', '$address', '$email', '$gender', 'md5('$mypwd))";
if(mysqli_query($conn,$sql))
{
echo"<script type=\"text/javascript\">
alert(Welcome);
window.location=\"login.php\";
</script>";
}
else
{
echo "Error inserting values into database";
}
}
}
?>

