Insert into more than 1 database:PHP

I have a table called vendor_keys.
It has 2 fields:
1. vendor_name
2. key_provided.

The Same table is inside 3 databases.And I want to insert the details into all 3 databases at once.
Following is the code to insert details into 3 databases.

<?php
header("Access-Control-Allow-Origin: *");
$vendor_name=$_POST['vendor_name'];
$key_provided=$_POST['key_provided'];
$password=$_POST['password'];

$servername = "localhost";
$username = "root"; //replace with your username
$password = ""; //replace with your password

$database1 = "db1"; //replace with your first database name
$database2 = "db2"; //replace with your second  database name
$database3 = "db3"; //replace with your third database name
$dbh1 = new mysqli($servername, $username, $password, $database1);

if($dbh1->connect_errno > 0){
die('Unable to connect to database' . $dbh1->connect_error);
}

$dbh2 = new mysqli($servername, $username, $password, $database2);
if($dbh2->connect_errno > 0){
die('Unable to connect to database' . $dbh2->connect_error);
}

$dbh3 = new mysqli($servername, $username, $password, $database3);
if($dbh3->connect_errno > 0){
die('Unable to connect to database' . $dbh3->connect_error);
}

$add_vendor="INSERT INTO `vendor_keys`(`vendor_name`, `key_provided`) VALUES ('$vendor_name','$key_provided')";

$sql1 = mysqli_query($dbh1,$add_vendor);
$sql2 = mysqli_query($dbh2,$add_vendor);
$sql3 = mysqli_query($dbh3,$add_vendor);

echo "<br>";
echo 'VENDOR ADDED SUCCESSFULLY.<br>';

?>

265 thoughts on “Insert into more than 1 database:PHP

  1. Pingback: Google
  2. Pingback: apunts 2961
  3. Pingback: hunting equipment
  4. Pingback: male bondage gear
  5. Pingback: Food coupons
  6. Pingback: Sad Shayari
  7. Pingback: kegel weight balls
  8. Pingback: FIFA 19 Coins
  9. Pingback: Chicago SEO
  10. Pingback: Detroit SEO
  11. Pingback: Google
  12. Pingback: multqa.ae
  13. Pingback: best wand massager
  14. Pingback: body massager wand
  15. Pingback: best penis ring
  16. Pingback: Big Dick
  17. Pingback: chwilówki
  18. Pingback: girth enlargement
  19. Pingback: giant dildo
  20. Pingback: pink jelly dildo
  21. Pingback: anal vibrator
  22. Pingback: mail order bride
  23. Pingback: #workfromhomejobs
  24. Pingback: brazzers porn
  25. Pingback: Ravishing Rabbit
  26. Pingback: top anal sex toys
  27. Pingback: Store
  28. Pingback: fun88
  29. Pingback: 188bet
  30. Pingback: free app for pc
  31. Pingback: milf dating
  32. Pingback: live sex
  33. Pingback: full apps download
  34. Pingback: rencontres adulte
  35. Pingback: sexo ao vivo
  36. Pingback: deluxe thruster
  37. Pingback: douching
  38. Pingback: pocket pussy
  39. Pingback: Speelgoed bol
  40. Pingback: testicle ring
  41. Pingback: Gurgaon
  42. Pingback: cock ring
  43. Pingback: daniels sex toy
  44. Pingback: silver bullet toy
  45. Pingback: webcambabes
  46. Pingback: sexe webcam
  47. Pingback: double ended dildo
  48. Pingback: wall mounted dildo
  49. Pingback: sex toys
  50. Pingback: pocket stroker
  51. Pingback: 10 inch dildo
  52. Pingback: strapless strapon
  53. Pingback: increase penis
  54. Pingback: vibrator for her
  55. Pingback: vibrator sex toy
  56. Pingback: real dildo
  57. Pingback: Porn
  58. Pingback: jelly anal plug
  59. Pingback: Snovitra Strong
  60. Pingback: easy online loans
  61. Pingback: froggyads.com
  62. Pingback: app test
  63. Pingback: l2740dw driver
  64. Pingback: вибицес
  65. Pingback: penis enlarger
  66. Pingback: dp cock ring
  67. Pingback: dildo reviews
  68. Pingback: vibrating panty
  69. Pingback: 15% minoxidil buy
  70. Pingback: buysteriods
  71. Pingback: satta king
  72. Pingback: double sided video
  73. Pingback: giant dildo
  74. Pingback: anal plug kit
  75. Pingback: porn
  76. Pingback: pornland
  77. Pingback: dp fantasy ring
  78. Pingback: oral sex
  79. Pingback: hiking
  80. Pingback: male stroker
  81. Pingback: Verordnung
  82. Pingback: ssru.ac.th
  83. Pingback: big black dildo
  84. Pingback: bullet vibrator
  85. Pingback: porn
  86. Pingback: big dildo
  87. Pingback: body stocking
  88. Pingback: Viagra
  89. Pingback: Invest Togel
  90. Pingback: bdjobs bangla
  91. Pingback: Pakistani Suits
  92. Pingback: Fashion Station
  93. Pingback: sexboer
  94. Pingback: porno files
  95. Pingback: gratis films
  96. Pingback: pornofilmpjes
  97. Pingback: iptv definition
  98. Pingback: liteblue
  99. Pingback: wanachi massager
  100. Pingback: slim dildo
  101. Pingback: virtual visa card
  102. Pingback: unboxing vibrator
  103. Pingback: travel
  104. Pingback: vacuum pump
  105. Pingback: hundeseng xxl
  106. Pingback: nipple sex
  107. Pingback: plus size dildo
  108. Pingback: walmartone login
  109. Pingback: gay porn
  110. Pingback: type 1 diabetes
  111. Pingback: hotmail connexion
  112. Pingback: pink vibrator
  113. Pingback: bondage equipment
  114. Pingback: bondage equipment
  115. Pingback: bjs holiday hours
  116. Pingback: wand massager
  117. Pingback: my first willy
  118. Pingback: gay lube
  119. Pingback: podcast
  120. Pingback: blowjob tips
  121. Pingback: Free Funding
  122. Pingback: sbobet online
  123. Pingback: power rod vibrator
  124. Pingback: mojopc
  125. Pingback: Att.net Mail
  126. Pingback: Walmartone login
  127. Pingback: hasta karyolası
  128. Pingback: seo consulting
  129. Pingback: mesh jockstraps
  130. Pingback: pussy masturbator
  131. Pingback: boho jewelry
  132. Pingback: couples toys
  133. Pingback: penis vibrator
  134. Pingback: doc johnson
  135. Pingback: mide 675

Leave a Reply