sql >> Database teknologi >  >> RDS >> Mysql

MySqli-kommandoer ude af synkronisering; du kan ikke køre denne kommando nu

Herfra:http://dev. mysql.com/doc/refman/5.0/en/commands-out-of-sync.html

Opdater

Hvis du laver en variabel for forespørgslen og indsætter variablen direkte i noget som MySQL Workbench, kan du tjekke syntaksen før udførelse.

<?php
            function myConnection(){
              $myConnection = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
              return $myConnection;
            }   


    function register_user($register_data) { 
        array_walk($register_data, 'array_sanitize'); 
        //Make the array readable and seperate the fields from data 
        $fields = '`' . implode('`, `', array_keys($register_data)) . '`'; 
        $data = "'" . implode("', '", $register_data) . "'"; 
        //Insert the data and email an activation email to the user 
        $query = "INSERT INTO `members` ($fields) VALUES ($data)";
                    $myNewConnection = myConnection();          

                    if($result = mysqli_query($myNewConnection, $query)){ 
        email($register_data['mem_email'], 'Activate your account', "Hello " . $register_data['mem_first_name'] . ",\n\nThank you for creating an account with H Fencing. Please use the link below to activate your account so we can confirm you identity:\n\nhttp://blah.blah.co.uk/activate.php?mem_email=" . $register_data['mem_email'] . "&email_code=" . $register_data['email_code'] . "\n\n - David & Jay "); 
        mysqli_free_result($result);
         return ("Success");
        } else {
            echo $query;
            die(mysqli_error($myNewConnection));
        } 

    }

?>  



  1. MySQL ENUM type vs join tabeller

  2. MariaDB CEIL() Forklaret

  3. Hvordan indstilles global innodb_buffer_pool_size?

  4. MySQL giver alle privilegier til databasen undtagen én tabel