daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Apr 21st, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $qurum = explode('|', $qurum1);//1|2|6
  2.   foreach ($qurum as $value) {
  3.   $idareid = 'idare'.$value;
  4.   if (table_exists($idareid)) {
  5.     $sql = "SELECT qurum1 FROM data WHERE id = $id";//1|2|3
  6.     $res = mysql_query($query);
  7.     $get_qur = array();
  8.     $get_qur = mysql_fetch_assoc($res);
  9.     $get_q = explode('|', $get_qur);//1|2|3
  10.       foreach ($get_q as $k => $v) {
  11.         if (in_array($v, $qurum)) {
  12.           $mysql = "UPDATE ".$idareid." SET data_num = '$data_num',
  13.           input_date = '$input_date' WHERE data_id = $id";
  14.           $result = mysql_query($mysql) or die("O ".mysql_error());
  15.         } else {
  16.           $query = "DELETE FROM idare".$v." WHERE data_id = $id";
  17.           $r = mysql_query($query) or die("w ".mysql_error());
  18.           $mysql2 = "INSERT INTO ".$idareid." (data_id, data_num, input_date) VALUES
  19.                     ('$id', '$data_num', '$input_date')";
  20.           $result2 = mysql_query($mysql2) or die("i ".mysql_error());
  21.                     }
  22.                 }
  23.         } else {
  24.             $q = "CREATE TABLE IF NOT EXISTS ".$idareid." ( " . $idareid . "_id tinyint(4)
  25. UNSIGNED NOT NULL AUTO_INCREMENT, `data_id` int(10) UNSIGNED NOT NULL, `data_num`
  26. varchar(255) NOT NULL, `input_date` date NOT NULL, PRIMARY KEY(" . $idareid ."_id))
  27. ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
  28.             $res2 = mysql_query($q) or die("b ".mysql_error());
  29.             $query2 = "INSERT INTO ".$idareid." (data_id, data_num, input_date) VALUES
  30.              ('$id', '$data_num', '$input_date')";
  31.         $res3 = mysql_query($query2) or die("k".mysql_error());
  32.         }
  33.  
  34.     }
RAW Paste Data
Top