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


        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

            //capture the variable from the form and store in php variables


            //connecting to the server


            $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!!');
                //insert data into table

                $sql = "INSERT INTO members
                VALUES('$title', '$fullname', '$lastname', '$screenname', '$address', '$email', '$gender',  'md5('$mypwd))";

                    echo"<script type=\"text/javascript\">
                    echo "Error inserting values into database";




Recommended Answers

What error message are you getting? What isn't working as intended?

Jump to Post

All 5 Replies

What error message are you getting? What isn't working as intended?

that is the problem dani, am not getting any kind of errors that i can show, all it say error inserting data in database, so i dont know if it is some error within the code and I am not seeing it. and i run it again and i am now seeing this error,

the error is the variable $conn,

Notice: Undefined variable: conn in C:\wamp64\www\Taylor_Luana_ITEC244_Assignment\php\register_user.php on line 35

I use the echo, to echo out the error and that is how that error come up

Is the question still relevant?

I got it fix thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.