All pastes #518330 Raw Edit

Someone

public text v1 · immutable
#518330 ·published 2007-05-29 08:35 UTC
rendered paste body
			// how many rows we have in database
$query   = "SELECT COUNT(id) AS numrows FROM art_content";
$result  = mysql_query($query) or die('Error, query failed');
$row     = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];

// how many rows to show per page
$rowsPerPage = 3;
$maxPage = ceil($numrows/$rowsPerPage);
$min = "1";
$max = $numrows;
$pageNum = rand($min,$maxPage);

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query  = "SELECT id,articles,title FROM art_content LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
while($row = mysql_fetch_array($result))
{
	$dbtitle = stripslashes($row['title']);
	$replace = $artreplace;
	$arttitle = str_replace($replace, "", $dbtitle);
	$content  .= "<b>" . $arttitle . "</b><br>(<A HREF=\"index.php?p=article&amp;id=".$row['id']."\"><FONT COLOR=\"#0000ff\" onclick=\"this.innerHTML = 'Loading!'; this.style.color = '#ff0000';\" onclick=\"this.innerHTML = 'Read More'; this.style.color = '#0000ff';\">Read More</FONT></A>)<p>\n";
}
randomrep ($content,'p',$rep120900);
unset ($content);