Advertisement
GWibisono

mysqli testing

Aug 14th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $mysqli = new mysqli("localhost", "root", "", "test");
  3. /*
  4. koneksi jgn lupa diperbaiki ya..
  5. copas setelah dibawah ini.. tp atasnya jgn lupa ada mysqli
  6. */
  7.     /* check connection */
  8.     if (mysqli_connect_errno()) {
  9.         printf("Connect failed: %s\n", mysqli_connect_error());
  10.         exit();
  11.     }
  12. $sql="CALL st_dsml('01')";
  13. $q2=$mysqli->query($sql);  
  14. /*
  15. tidak di satukan agar rapi
  16. dan mudah dibaca pemula
  17. */
  18. if(!$q2)
  19. {
  20.     die( $mysqli->error."<br>$sql");
  21. }
  22.  
  23. //while ($rows = mysqli_fetch_array($result1, MYSQLI_ASSOC))
  24. while($row = $q2->fetch_assoc())
  25. {
  26.     $jnopel=$rows['nopel'];
  27.     $jnama=$rows['nama'];
  28.     $jalamat=$rows['alamat'];
  29.     $jwilayah=$rows['Wilayah'];
  30.     $jawal=$rows['awal'];
  31.     $jakhir=$rows['akhir'];
  32.     $jtarif=$rows['tarif_cd'];
  33.     $sql = "INSERT INTO tr_temp_dsml SET nopel='$jnopel', nama='$jnama', alamat='$jalamat', wilayah='$jwilayah', awal='$awal', akhir='$akhir', bad='0'";
  34.     $q2=$mysqli->query($sql);
  35.     if(!$q2)
  36.     {
  37.         die( $mysqli->error."<br>$sql");
  38.     }
  39.    
  40. }
  41.  
  42. //mysqli_close($connect);
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement