Create a query box same as PHP-MyAdmin

Hello everyone,
Once I had a task to create a query-box, which is similar to phpmyadmin SQL tab.
Following the code which I wrote for it.
It is very useful in the cases where you know the data structure and you don’t want to open cpanel again and again to check the code.

/*
1. Create a file called fetch_data_api.php
Put following code into it.
*/
<font color=”red”><B>ENTER YOUR MYSQL QUERY HERE:</B></font>
<BR>
<form action=”#” method=”POST”>
<textarea  name=”run_query” rows=”4″ cols=”50″>
</textarea>

<input type=”SUBMIT” name=”submit”>
</form>
<br>
<?php
if (isset($_POST[‘submit’])) {
echo “<br>”;
echo $run_query= $_POST[‘run_query’];
echo “<br>”;
// create curl resource
$ch = curl_init();
// is cURL installed yet?
if ($ch){
//      echo (‘ cURL is  installed!’);
}
// set url
$set_url = curl_setopt($ch, CURLOPT_URL, “http://yourdomain/yourfolder/fetch_data_sql.php”);

if($set_url)
{
// echo “URL SET”;
}

curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, “run_query=”.$run_query);
//return the transfer as a string
$trasfer =curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($trasfer)
{
// echo “transfer”;
}
// $output contains the output string
$output = curl_exec($ch);
// echo $output;
if($output)
{
// echo “EXECUTED”;
}
else
{
// echo “Error Number:”.curl_errno($ch).”<br>”;
//       echo “Error String:”.curl_error($ch);
}

//exit();
// close curl resource to free up system resources
curl_close($ch);
$array = json_decode( $output, true );;
//print_r($array);

echo ‘<table border=”1″ cellspacing=”0″ cellpadding=”0″ width=”100%”>’;
// print table header
echo “<thead><tr>”;
foreach($array[0] as $key=>$value){
echo “<th>$key</th>”;
}
echo “</tr></thead>”;
foreach($array as $row) {
echo(‘<tr>’);
foreach($row as $cell) {
echo(‘<td>’ . $cell . ‘</td>’);
}
echo(‘</tr>’);
}
echo ‘</table>’;
}
?>


/*2. create file called: fetch_data_sql.php*/
<?php
header(“Access-Control-Allow-Origin: *”);
header(“Content-Type: application/json; charset=UTF-8”);

$servername = “localhost”; //hostname
$username = “root”; //username
$password = “”; //your password

$dbname = “db1”;

$dbh1 = mysql_connect($servername, $username, $password);

mysql_select_db($dbname, $dbh1);

$run_query=$_POST[‘run_query’];

$sql=mysql_query($run_query);
$arr_json = array();
$json= “[“;
while ($row = mysql_fetch_assoc($sql)) {
if ($json != “[“) {$json .= “,”;}
$json .= json_encode($row);
$arr_json[] .= $json;
}

$json .= “]”;
echo($json);

?>

510 thoughts on “Create a query box same as PHP-MyAdmin

  1. Pingback: Google
  2. Pingback: Google
  3. Pingback: 토토사이트
  4. Pingback: porn massage
  5. Pingback: hunting equipment
  6. Pingback: bondage set
  7. Pingback: 먹튀검증
  8. Pingback: ADM Chapter 13
  9. Pingback: ONGC Requirement
  10. Pingback: kegel wand
  11. Pingback: luxury sex toys
  12. Pingback: shmmovers.com
  13. Pingback: Big Cock
  14. Pingback: thrusting dildo
  15. Pingback: chwilówki
  16. Pingback: ipad screen repair
  17. Pingback: penis extender
  18. Pingback: bullet massager
  19. Pingback: male prostate toy
  20. Pingback: real feel dildo
  21. Pingback: Nerf Gun
  22. Pingback: mail order bride
  23. Pingback: xxnxx
  24. Pingback: anal sex toys
  25. Pingback: Expensive
  26. Pingback: butt plugs
  27. Pingback: penis enlarger
  28. Pingback: kegel balls
  29. Pingback: strapless strap on
  30. Pingback: 188bet
  31. Pingback: rijpe vrouw
  32. Pingback: sekscamera
  33. Pingback: sl-m2070wxaa
  34. Pingback: apps for pc
  35. Pingback: cameras ao vivo
  36. Pingback: rencontres adulte
  37. Pingback: anal butt plug
  38. Pingback: how to anal douche
  39. Pingback: play free pc games
  40. Pingback: bullet vibrator
  41. Pingback: hamptonbaylight
  42. Pingback: Times of India
  43. Pingback: cock ring
  44. Pingback: dani best videos
  45. Pingback: dong vibrator
  46. Pingback: silicone vibrator
  47. Pingback: sexe webcam
  48. Pingback: sexe webcam
  49. Pingback: top thrusting toy
  50. Pingback: prostate sex toy
  51. Pingback: sex toys
  52. Pingback: gay huge dildo
  53. Pingback: realistic stroker
  54. Pingback: strap ons
  55. Pingback: weird sex toy
  56. Pingback: Porn Land
  57. Pingback: anal training kit
  58. Pingback: Snovitra Strong
  59. Pingback: smt1500rm2u manual
  60. Pingback: penis vacuum pump
  61. Pingback: male glans ring
  62. Pingback: vaginal balls
  63. Pingback: squirting dildo
  64. Pingback: big didlo
  65. Pingback: rabbit vibrator
  66. Pingback: foreplay games
  67. Pingback: 15% minoxidil
  68. Pingback: pussy stroker
  69. Pingback: thick dildo
  70. Pingback: g spot toy
  71. Pingback: bullet vibe
  72. Pingback: dilator
  73. Pingback: bdsm kit
  74. Pingback: porn land
  75. Pingback: unboxing
  76. Pingback: how to deep throat
  77. Pingback: climbing harness
  78. Pingback: double stroker
  79. Pingback: commission
  80. Pingback: large dong
  81. Pingback: rabbit vibe
  82. Pingback: mens pleasure toys
  83. Pingback: black giant dildo
  84. Pingback: paddle sex
  85. Pingback: latest vibrators
  86. Pingback: bondage sex toys
  87. Pingback: vibrating egg
  88. Pingback: porn land
  89. Pingback: luksus hundeseng
  90. Pingback: pkv gamess secrets
  91. Pingback: Exchange Programs
  92. Pingback: Fashion Station
  93. Pingback: Pool Light
  94. Pingback: sexboer
  95. Pingback: porno files
  96. Pingback: geile sex filmpjes
  97. Pingback: gratis films
  98. Pingback: pornofilmpjes
  99. Pingback: liteblue
  100. Pingback: mini massager
  101. Pingback: dildo
  102. Pingback: virtual visa card
  103. Pingback: travel
  104. Pingback: nipple clamping
  105. Pingback: xvideos
  106. Pingback: double dong
  107. Pingback: one walmart login
  108. Pingback: Bluechew reviews
  109. Pingback: spolorm hund
  110. Pingback: www.hotmail.fr
  111. Pingback: SUC Elibrary
  112. Pingback: gay toy bondage
  113. Pingback: costco hours
  114. Pingback: bullet vibrator
  115. Pingback: podcast
  116. Pingback: ceme online
  117. Pingback: city to city ride
  118. Pingback: g spot vibrator
  119. Pingback: tax free
  120. Pingback: couples penis ring
  121. Pingback: cheap csgo cheats
  122. Pingback: Yahoo Mail Sign In
  123. Pingback: Hotmail Sign In
  124. Pingback: porn free
  125. Pingback: briefs
  126. Pingback: boho bracelet
  127. Pingback: Ultras brand
  128. Pingback: couples sex toys
  129. Pingback: iraniporn
  130. Pingback: mide 676
  131. Pingback: xxx
  132. Pingback: gay toys online
  133. Pingback: YtMp3
  134. Pingback: security
  135. Pingback: hotmail outlook
  136. Pingback: outlook sign in
  137. Pingback: MVSD-397
  138. Pingback: ssni 546
  139. Pingback: glass dildo
  140. Pingback: butt plug set
  141. Pingback: big ass ebony anal
  142. Pingback: Shatta Wale Music
  143. Pingback: ama questions
  144. Pingback: prepaidgiftbalance
  145. Pingback: 192.168 1.254
  146. Pingback: NHDTB-308
  147. Pingback: top 5 sex toys
  148. Pingback: sex video download
  149. Pingback: btc to neteller
  150. Pingback: buttplug porn
  151. Pingback: jockstraps
  152. Pingback: app for pc
  153. Pingback: Eweka
  154. Pingback: numb spray
  155. Pingback: one.walmart.com
  156. Pingback: Dank Vapes
  157. Pingback: Dank Vapes
  158. Pingback: Chat Teen Live
  159. Pingback: Baccarat System
  160. Pingback: ABP 898
  161. Pingback: runelite
  162. Pingback: MEYD-525
  163. Pingback: Women clothing
  164. Pingback: 618media.com
  165. Pingback: hoops
  166. Pingback: Bitcoin news
  167. Pingback: ManyCam Crack
  168. Pingback: Dankwoods
  169. Pingback: valium for sale
  170. Pingback: gay male underwear
  171. Pingback: gay bondage gear
  172. Pingback: dank cartridges
  173. Pingback: logo designers
  174. Pingback: jelly vibrator
  175. Pingback: anal douching
  176. Pingback: SEO Vancouver
  177. Pingback: daftar joker123
  178. Pingback: GVG 941
  179. Pingback: Mumbai Escorts
  180. Pingback: ama
  181. Pingback: milfgilf porn
  182. Pingback: crazybulk estafa
  183. Pingback: OYC 278
  184. Pingback: CESD-812
  185. Pingback: sewa led screen
  186. Pingback: air Jordan
  187. Pingback: عرب نار
  188. Pingback: giant dildo
  189. Pingback: nipple suckers
  190. Pingback: hotmail sign in
  191. Pingback: Thc vape juice
  192. Pingback: vape shop
  193. Pingback: g spot
  194. Pingback: Tagius events
  195. Pingback: web hosting
  196. Pingback: MIDE 685
  197. Pingback: MIAA-159
  198. Pingback: txxx porn
  199. Pingback: Vape near me
  200. Pingback: buy vape online
  201. Pingback: app for laptop
  202. Pingback: THC vape juice
  203. Pingback: vape shop online
  204. Pingback: Roselle Prost
  205. Pingback: flexi spy
  206. Pingback: ABP 906
  207. Pingback: ADN-227
  208. Pingback: liteblue
  209. Pingback: dildos
  210. Pingback: virtual debit card
  211. Pingback: jewelry stores
  212. Pingback: oxycodone for sale
  213. Pingback: cypionate online
  214. Pingback: Best smm panel
  215. Pingback: prostate sex toys
  216. Pingback: pc app
  217. Pingback: Mario cart
  218. Pingback: weed for sale
  219. Pingback: info
  220. Pingback: Order marijuana
  221. Pingback: TEFL jobs
  222. Pingback: american whopper
  223. Pingback: Century Sankya
  224. Pingback: viagra
  225. Pingback: buy viagra
  226. Pingback: free app download
  227. Pingback: cheap mattress
  228. Pingback: viagra
  229. Pingback: cbd for sale
  230. Pingback: cbd oil for sale
  231. Pingback: cialis
  232. Pingback: stopoverdoseil.org
  233. Pingback: buy lipitor online
  234. Pingback: vibrator

Leave a Reply