Ehsanmot Posted May 27, 2018 Share Posted May 27, 2018 Hi I'm creating a new provisioning module that can edit an external database just after a payment of a client received. For example when a client purchased a service, this module create a row with the username, password and email of the client in an external database. i know how to connect to an external database but i don't know how to do other things... please help me and sorry for my bad english. this is my code for this module: <?php $servername11 = "localhost"; $username11 = "databaseusername"; $password11 = "databasepass"; $dbname11 = "databasename"; // Create connection $conn = new mysqli($servername11, $username11, $password11, $dbname11); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO nn_users (username, email, password) VALUES ('????', '????', '????')"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error updating record: " . $conn->error; } $conn->close(); ?> 0 Quote Link to comment Share on other sites More sharing options...
Jeronk Posted January 18, 2021 Share Posted January 18, 2021 I would also like to know how 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted January 21, 2021 Share Posted January 21, 2021 Would be better to use PDO with prepare function so it sanitizes the fields but a simple insert query would be: $sql = "INSERT INTO nn_users (username, email, password) VALUES ($username, $email, $password)"; 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.