function lookupPersonCallback() { $id = addslashes($_POST['id']); $args = array('post_type' => 'eweek_participants', 'post_status' => 'publish', 'posts_per_page' => -1, 'page_id' => $id); $the_query = new WP_Query($args); // The Loop $people = array(); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); global $post; //add person's name to this cause life is hard and people are dumb $title = get_the_title(); $person = get_post_meta(get_the_ID()); $person['name'] = array($title); $person['id'] = array('' . get_the_ID()); $person['pointsCalc'] = calcPoints($person['events_attended'][0]); array_push($people, $person); } echo json_encode($people); } else { echo "notFound"; } wp_die(); }
$round = $_POST['round']; $event = $_POST['event']; $attempt = $_POST['attempt']; $ath_res_db = formatResultDB($ath_res); $ath_wind_db = formatWindDB($ath_res, $ath_wind); if ($ath_res_db == 'error') { $return = 'result'; } else { try { $sql_sex = "SELECT Geschlecht \r\n FROM kategorie \r\n LEFT JOIN wettkampf USING(xKategorie) \r\n LEFT JOIN start USING(xWettkampf) \r\n LEFT JOIN serienstart USING(xStart) \r\n WHERE xSerienstart = :ath_id;"; $query_sex = $glb_connection_server->prepare($sql_sex); $query_sex->bindValue(':ath_id', $ath_id); $query_sex->execute(); $sex = $query_sex->fetch(PDO::FETCH_ASSOC); $sex = $sex['Geschlecht']; $points = calcPoints($event, $ath_res_db, $fraction = 0, $sex, $ath_id); $res_id_sql = !is_null($res_id) ? "xResultat = :res_id, " : ""; $sql = "INSERT INTO resultat\r\n SET " . $res_id_sql . "\r\n Leistung = :ath_res\r\n , Info = :ath_wind\r\n , Punkte = :ath_pts\r\n , xSerienstart = :ath_id\r\n ON DUPLICATE KEY UPDATE\r\n Leistung = :ath_res\r\n , Info = :ath_wind\r\n , Punkte = :ath_pts\r\n , xSerienstart = :ath_id\r\n ;"; $query = $glb_connection_server->prepare($sql); // +++ bind parameters if (!is_null($res_id)) { $query->bindValue(':res_id', $res_id); } $query->bindValue(':ath_res', $ath_res_db); $query->bindValue(':ath_wind', $ath_wind_db); $query->bindValue(':ath_pts', $points); $query->bindValue(':ath_id', $ath_id); // --- bind parameters $query->execute(); $sql_skip = "SELECT IF(COUNT(*)>0,1,0) AS skip\r\n FROM resultat \r\n WHERE xSerienstart = :serienstart\r\n AND Leistung IN (" . implode(',', $glb_results_skip) . ");"; $query_skip = $glb_connection_server->prepare($sql_skip);