setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $values = getValues($dbhandle, $table_r); $diffs = getDiff($values, $score_name); insertValues($dbhandle, $table_d, $diffs); $dbhandle = null; function getValues($h, $t) { $query = $h -> prepare("SELECT * FROM ".$t); $query -> execute(); $records = $query -> fetchAll(); return $records; } function getDiff($v, $s){ $return = array(); for($i = 1; $i prepare("DELETE FROM ".$t); $delete -> execute(); foreach($d as $v) { $query = $h -> prepare("INSERT INTO ".$t." VALUES (:start, :eb_r_k, :eb_r_d, :eb_b_k, :eb_b_d, :eb_g_k, :eb_g_d, :rh_r_k, :rh_r_d, :rh_b_k, :rh_b_d, :rh_g_k, :rh_g_d, :bh_r_k, :bh_r_d, :bh_b_k, :bh_b_d, :bh_g_k, :bh_g_d, :gh_r_k, :gh_r_d, :gh_b_k, :gh_b_d, :gh_g_k, :gh_g_d )"); $query->bindParam(':start', $v['start'], PDO::PARAM_STR); $query->bindParam(':eb_r_k', $v['eb_r_k'], PDO::PARAM_INT); $query->bindParam(':eb_r_d', $v['eb_r_d'], PDO::PARAM_INT); $query->bindParam(':eb_b_k', $v['eb_b_k'], PDO::PARAM_INT); $query->bindParam(':eb_b_d', $v['eb_b_d'], PDO::PARAM_INT); $query->bindParam(':eb_g_k', $v['eb_g_k'], PDO::PARAM_INT); $query->bindParam(':eb_g_d', $v['eb_g_d'], PDO::PARAM_INT); $query->bindParam(':rh_r_k', $v['rh_r_k'], PDO::PARAM_INT); $query->bindParam(':rh_r_d', $v['rh_r_d'], PDO::PARAM_INT); $query->bindParam(':rh_b_k', $v['rh_b_k'], PDO::PARAM_INT); $query->bindParam(':rh_b_d', $v['rh_b_d'], PDO::PARAM_INT); $query->bindParam(':rh_g_k', $v['rh_g_k'], PDO::PARAM_INT); $query->bindParam(':rh_g_d', $v['rh_g_d'], PDO::PARAM_INT); $query->bindParam(':bh_r_k', $v['bh_r_k'], PDO::PARAM_INT); $query->bindParam(':bh_r_d', $v['bh_r_d'], PDO::PARAM_INT); $query->bindParam(':bh_b_k', $v['bh_b_k'], PDO::PARAM_INT); $query->bindParam(':bh_b_d', $v['bh_b_d'], PDO::PARAM_INT); $query->bindParam(':bh_g_k', $v['bh_g_k'], PDO::PARAM_INT); $query->bindParam(':bh_g_d', $v['bh_g_d'], PDO::PARAM_INT); $query->bindParam(':gh_r_k', $v['gh_r_k'], PDO::PARAM_INT); $query->bindParam(':gh_r_d', $v['gh_r_d'], PDO::PARAM_INT); $query->bindParam(':gh_b_k', $v['gh_b_k'], PDO::PARAM_INT); $query->bindParam(':gh_b_d', $v['gh_b_d'], PDO::PARAM_INT); $query->bindParam(':gh_g_k', $v['gh_g_k'], PDO::PARAM_INT); $query->bindParam(':gh_g_d', $v['gh_g_d'], PDO::PARAM_INT); $query->execute(); } } ?>