PHP MySQL Cannot use "INSERT INTO" -
this question has answer here:
- php mysql insert not working 6 answers
i have created webpage named register.php should insert data database. problem registration page works when try log in information not added database there did wrong cannot find?
<?php echo "<h1>register</h1>"; $submit = $_post['submit']; //form data $fullname = strip_tags($_post['fullname']); $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); $repeatpassword = strip_tags($_post['repeatpassword']); if ($submit) { //open database $connect = mysql_connect("localhost","root",""); mysql_select_db("cs266db_db1"); $namecheck = mysql_query("select username user_id username='$username'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("username taken"); } //check existence if($fullname&&$username&&$password&&$repeatpassword) { //check password , repeat password match if($password==$repeatpassword) { //check length of username , fullname if (strlen($username) > 25 || strlen($fullname)>25) { echo "length of username or fullname on 25 characters!"; } else { //check password if(strlen($password)>25 || strlen($password) < 6) { echo "password must between 6 , 25 characters"; } else { //encrypt password $password = md5($password); $repeatpassword = md5($repeatpassword); $queryreg = mysql_query("insert user_id values (fullname='".$fullname."',username='".$username."',password='".$password."'"); } die("you have been registered <a href='index1.php'> return login page </a>"); } } else{ echo "your passwords not match"; } } else { echo "please fill in fields!"; } } ?> <html> <form action="register.php" method="post"> <table> <tr> <td> full name: </td> <td> <input type="text" name="fullname" value="<?php echo $fullname ?>"> </td> </tr> <tr> <td> choose username: </td> <td> <input type="text" name="username" value="<?php echo $username ?>"> </td> </tr> <tr> <td> choose password: </td> <td> <input type="password" name="password"> </td> </tr> <tr> <td> repeat password: </td> <td> <input type="password" name="repeatpassword"> </td> </tr> </table> <br> <input type="submit" name="submit" value="register"> </form> </html>
im getting error of well(i running on netbeans):
notice: undefined index: submit in c:\xampp\htdocs\resume_db\register.php on line 4 notice: undefined index: fullname in c:\xampp\htdocs\resume_db\register.php on line 7 notice: undefined index: username in c:\xampp\htdocs\resume_db\register.php on line 8 notice: undefined index: password in c:\xampp\htdocs\resume_db\register.php on line 9 notice: undefined index: repeatpassword in c:\xampp\htdocs\resume_db\register.php on line 10
does have problem of insertion? if can help! please , thank you!
i don't think the way run insert valid in mysql, tried on mysql on wamp , line not return error values been insert null i'm talking line
insert tmp_table values (`field_1`='value_1', `field_2`='value_2', `field_3`='value_3' ...)
do empty rows in db or no rows @ ?
Comments
Post a Comment