-1
    (adduser.php)
    <?php
    require('./database.php');
        $username = mysqli_real_escape_string($connection,$_POST['username']);
        $fullname = mysqli_real_escape_string($connection,$_POST['fullname']);
        $contact = mysqli_real_escape_string($connection,$_POST['contact']);
        $password = mysqli_real_escape_string($connection,md5($_POST['password']));
        $queryinsert = "INSERT INTO tbl_userinfo VALUES (null, ?, ?, ?, ?)";
        $queryconnection = mysqli_stmt_init($connection);
        if(!mysqli_stmt_prepare($queryconnection, $queryinsert)){
            echo "<script type='text/javascript'>alert('SQL ADDED ERROR');</script>";
        }
        else{
            mysqli_stmt_bind_param($queryconnection, "ssss", $username, $fullname, $contact, $password);
            mysqli_stmt_execute($queryconnection);
        }
    ?>
    
    (queryuseradmin.js)   
  let username = document.forms["userform"]["username"].value;
        let fullname = document.forms["userform"]["fullname"].value;
        let contact = document.forms["userform"]["contact"].value;
        let password = document.forms["userform"]["password"].value;
    

        $.post("../controller/adduser.php",{"username": username, "fullname": fullname, "contact": contact, "password": password},function data(){             
                        document.querySelector('.bg-successmodal').style.display='flex';
                         setTimeout(function(){ document.querySelector('.bg-successmodal').style.display='none';
                         },1500); 
                         $.post("../controller/useradminquery.php",{cache: false}, function data(data){
                            $('#tableid').html(data); 
                        });     
                         $('#userformid')[0].reset();                  
                        });  

cannot figure out the error can someone analyze this codes why it does not working to insert data it is almost 2 days still figuring out

  • Any chance to see your `tbl_userinfo` table structure? – ugnuku May 14 '22 at 03:56
  • userid, username, fullname, contact, password – Alnoor Manoga May 14 '22 at 04:02
  • although it is not clear, which part is not working (JS or PHP), I am closing this question based on the title. – Your Common Sense May 14 '22 at 04:19
  • If the best description you can give after 2 days is "not working" then, in the friendliest way possible, you need to pay more attention to the study of debugging techniques. You should have been able to narrow it down more than that by now – ADyson May 14 '22 at 08:18

0 Answers0