javascript - Failing insert statement in msql -
i'm new programming in php , javascript bare me. below section of code causing me problems:
$usertype = $_post['usertype']; if ($usertype == "administration") { ?> <script type='text/javascript'> window.onload = promptmessage; function promptmessage() { var x = 38773; var code = prompt('enter administration code have been given:', 'enter code here'); if (code == x) { alert("administration code accepted"); } else { var secondcode = prompt('the code have entered inccorect', 'enter correct code here or change usertype'); if (secondcode == x) { alert("administration code accepted"); } else { location.href = 'admincodefail.html'; } } } </script> <?php $con = mysqli_connect("localhost:3306", "root", "***********", "systemone"); $sql = "insert completeinfo (firstname, surname, uniid, housenumber, addresslineone, addresslinetwo, city, postcode, county, phonenumber, email, username, password, usertype) values ('$_post[firstname]','$_post[surname]','$_post[uniid]', '$_post[housenumber]','$_post[addresslineone]', '$_post[addresslinetwo]','$_post[city]','$_post[postcode]', '$_post[county]','$_post[contactnumber]','$_post[email]', '$_post[username]','$_post[password]','$_post[usertype]')"; if (!mysqli_query($con, $sql)) { die('error: ' . mysqli_error($con)); } else { header("location:signupcomplete.html"); }
the problem i'm having insert query not working. query fails insert data database , @ loss why. connection database working fine , i'm receiving no errors when testing query itself. why isn't query functioning. suggestion appreciated.
add
error_reporting(e_all); ini_set('display_errors', '1');
after code , give more descriptive errors why query failing.
Comments
Post a Comment