Gistrec

Mysql compare two table

Mar 1st, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1.          $allCount = $this->mysqli->query("select count(*) from auth");
  2.          $allCount = $allCount->fetch_assoc()["count(*)"];
  3.          for ($i = 0; $i < $allCount; $i++){
  4.              $player = ($this->mysqli->query("select `login` from `auth` limit $i, 1")->fetch_assoc())['login'];
  5.              $issetPlayer = $this->mysqli->query("select `login` from `data` where `login` = '$player'");
  6.              if ($issetPlayer->num_rows < 1){
  7.                 //return (var_dump($player, $i, $issetPlayer));
  8.                 $this->mysqli->query("INSERT INTO `data`(login) VALUES('$player')");
  9.              }
  10.  
  11.  
  12.          }
Advertisement
Add Comment
Please, Sign In to add comment