hi
am doing this assignment in web develpment. have been trying to run it but for some reason it is not working.
maybe a third eye will hope
here is the code
<?php
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_username,$db_password) 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/popup.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";
}
}
}
?>