User:Krinkle/Queries/nlwiki ntharticles more

From Meta, a Wikimedia project coordination wiki
nl.wikipedia.org : Nth articles (more)
    Last update: 2010-08-13 14:32 (UTC)
# nlwiki_ntharticles.php
echo "<pre>";
foreach(array(1,100,1000,10000,100000,250000,500000) as $nth){

$nth=$nth-1; if($nth < 0){ $nth = 0; } // array-values are given with 1 as starting point (database counts 0 as first one)
	
	/* Get the nth item */

	$dbQuery = "
SELECT	*
FROM  page
WHERE page_namespace=0
AND   page_is_redirect=0
ORDER BY page_id ASC
LIMIT $nth,1";

	$dbResult = mysql_query($dbQuery,$dbConnect);
	
	if(!!$dbResult){
		$a = mysql_fetch_assoc($dbResult);
		$s =
			"<li value=". ($nth+1) . "> [[:nl:"
			. $a['page_title']
			. "|]]"
			. " ("
			. $a['page_id']
			. ")";
		echo htmlentities($s, ENT_NOQUOTES, "UTF-8");
	} else {
		echo "Can not select query: \n" . mysql_error();
	}
	
	/* Get revision information */
	$dbQuery = "
SELECT	*
FROM  revision
WHERE rev_page=".$a['page_id']."
ORDER BY rev_timestamp ASC
LIMIT 1";

	$dbResult = mysql_query($dbQuery,$dbConnect);
	
	if(!!$dbResult){
		$a = mysql_fetch_assoc($dbResult);
		$s = 
			" . . created by ".$a['rev_user_text']." on ".date("Y-m-d H:i:s", strtotime($a['rev_timestamp'])).". [http://nl.wikipedia.org/?oldid=".$a['rev_id']." Revision]</li>
";
		echo htmlentities($s, ENT_NOQUOTES, "UTF-8");
	} else {
		echo "Can not select query: \n" . mysql_error();
	}
	
}
echo "</pre>";
  1. Albert_Speer (1) . . created by node-c-226b.a2000.nl on 2002-08-01 23:04:48. Revision
  2. Biografielijst (134) . . created by Julien Pylyser on 2002-09-15 20:37:11. Revision
  3. Paaslam (1361) . . created by node-c-2246.a2000.nl on 2002-03-30 22:58:08. Revision
  4. Willie_Colón (18328) . . created by 62.216.11.156 on 2003-08-05 10:16:26. Revision
  5. Alenquer (278086) . . created by RobotMichiel1972 on 2005-10-16 17:31:55. Revision
  6. Brüheim (719186) . . created by RobotMichiel1972 on 2006-12-27 21:27:39. Revision
  7. Discothèque (1486176) . . created by TheOld on 2008-11-30 15:38:11. Revision