Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2.     $servername = "localhost";
  3.     $username = "root";
  4.     $password = "0snata";
  5.     $dbname = "auzvono";  
  6.     $conn = new mysqli($servername, $username, $password, $dbname);
  7.     if ($conn->connect_error) {
  8.         die("Greska: " . $conn->connect_error);
  9.     }
  10.     //
  11.     //$sql = "SELECT profil FROM profil";
  12.     //$result = $conn->query($sql);
  13.     //if ($result->num_rows > 0) {
  14.     //while($row = $result->fetch_assoc()) {
  15.     //if ($row["profil"] == '1'){
  16.     //  $query = 'Truncate table profil; INSERT INTO profil (profil) values (0);';
  17.     //  $conn->multi_query($query)}
  18.     //if ($row["profil"] == '0'){
  19.     //  $query = 'Truncate table profil; INSERT INTO profil (profil) values (1);';
  20.     //  $conn->multi_query($query)}    
  21.     //}
  22.  //}
  23.     //
  24.     $query = 'RENAME TABLE `prof` TO `profT`; RENAME TABLE `profA` TO `prof`; RENAME TABLE `profT` TO `profA`;';
  25.     if($conn->multi_query($query)) {
  26.         $conn->close();
  27.         return header('Location: index.php');
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement