org, '?') == 0 && strcmp($inWord->mean, '?') == 0 && strcmp($inWord->case, '?') == 0) { return true; } return false; } ?> xpath('//word'); echo "word number:" . count($wordsSutta) . "
"; $countInsert = 0; foreach ($wordsSutta as $ws) { $strPali = strtolower($ws->pali); $strPaliInEn = $strPali; $strOrg = $ws->org; $strMean = $ws->mean; $strGrama = $ws->case; if (inputWordIsEmpty($ws)) { continue; } $query = "select count(*) as rownum from tptdict where \"word\"='" . $ws->pali . "' AND \"org\"='" . $ws->org . "' AND \"mean\"='" . $ws->mean . "' AND \"gramma\"='" . $ws->case . "'"; $Fetch = PDO_FetchAll($query); $FetchNum = $Fetch[0]["rownum"]; if ($FetchNum == 0) { $query = "INSERT INTO tptdict ('id','worden','word', 'org', 'mean', 'gramma') VALUES (null,'" . $ws->pali . "','" . $ws->pali . "','" . $ws->org . "','" . $ws->mean . "','" . $ws->case . "')"; $stmt = @PDO_Execute($query); if (!$stmt || ($stmt && $stmt->errorCode() != 0)) { $error = PDO_ErrorInfo(); print_r($error[2]); //break; } $countInsert++; echo "insert-" . $ws->pali . "
"; } } echo "insert:" . $countInsert . " words
"; ?>