Jump to content

Edit History

Bewat

Bewat

- When a new customer register in Prestashop 1.7 I need the user to be also registered in another external system, it is a feedback system called phpBack. 

- Basically when he registers I need to insert his new customer values: $id_customer, $firstname, $lastname, $email and $password_hash, into phpBack database called "external" in a table called "users"

- I am successfully able to insert values manually to that database via classes/customer.php, but the thing is I need to retrieve the new user variables like in the following code:

 

<?php
$servername = "localhost";
$username = "external";
$password = "example";
$dbname = "external";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn1) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql1 = "INSERT INTO `users` (`id`, `name`, `email`, `pass`, `votes`, `isadmin`, `banned`) 
VALUES ($id_customer, '$firstname $lastname', '$email', '$passwordhash', 20, 0, 0);";
$result1 = mysqli_query($conn1, $sql1);

?>

Where and how in classes/customer.php can I take the new customer variables $id_customer, '$firstname $lastname', '$email', '$passwordhash' to insert them in external database?

Thanks in advance

Bewat

Bewat

- When a new customer register in Prestashop 1.7 I need the user to be also registered in another external system, it is a feedback system called phpBack. 

- Basically when he registers I need to insert his new customer values: $id_customer, $firstname, $lastname, $email and $password_hash, into phpBack database called "external" in a table called "users"

- I am successfully able to insert values manually to that database via classes/customer.php, but the thing is I need to retrieve the new user variables like in the following code:

 

<?php
$servername = "localhost";
$username = "external";
$password = "example";
$dbname = "external";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn1) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql1 = "INSERT INTO `users` (`id`, `name`, `email`, `pass`, `votes`, `isadmin`, `banned`) 
VALUES ($id_customer, '$firstname $lastname', '$email', '$passwordhash', 20, 0, 0);";
$result1 = mysqli_query($conn1, $sql1);

?>

 

Thanks in advance

×
×
  • Create New...