All pastes #759040 Raw Edit

Untitled

public php v1 · immutable
·published 2007-11-02 19:53 UTC
rendered paste body
$clause = array();if ($nb_author != "") {	$clause[] = "nb_auth LIKE '%$nb_author%'";}if ($nb_subj != "") {	$clause[] = "nb_subject LIKE '%$nb_subj%'";}if ($nb_num != "") {	$clause[] = "nb_number LIKE '%$nb_num%'";}if ($nb_type != "") {	$clause[] = "nb_type LIKE '%$nb_type%'";}$clause = implode(' AND ', $clause);// Pagination$limit = 25;               $query_count = "SELECT count(*) FROM Notebooks WHERE $clause"; $result_count = mysql_query($query_count);    $totalrows = mysql_result($result_count,0,0); $new_clause = preg_replace("/[%]/", "", $clause);echo "<span class=\"textBold\">Search Results for: $new_clause </span><BR><br>";if(!isset($page)){ 	$page = 1;      }$limitvalue = $page * $limit - ($limit); $query  = "SELECT * FROM Notebooks WHERE $clause LIMIT $limitvalue, $limit";        echo 'Query: "'. $query .'"<br />';$result = mysql_query($query) or die("Error: " . mysql_error()); if ($page != 1){ 	$pageprev = $page--;	echo("<a href=\"$PHP_SELF?page=$pageprev\">Prev</a> ");  } else {	echo("Prev "); }$numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){	if($i == $page){		echo($i." of ");	}else{		echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); 	}}	if(($totalrows % $limit) != 0){	if($i == $page){		echo($i." of ");	}else{		echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");	}} if(($totalrows - ($limit * $page)) > 0){	$pagenext = $page++;	echo("<a href=\"$PHP_SELF?page=$pagenext\">Next</a>");} else {	echo("Next"); } print ($query);// Display the results//echo "<p>";//echo "<div style=\"text-align: right\">";//echo "Show Entries | <a href=\"nb_search.php?sort=10\">10</a> | <a href=\"nb_search.php?sort=20\">20</a> | <a href=\"nb_search.php?sort=30\">30</a> | <a href=\"nb_search.php?sort=50\">50</a> | <a href=\"nb_search.php?sort=100\">100</a> | ";//echo "</div>";//echo "</p>";echo "<table id=\"TblHDRs\" width=\"500\">";echo "<tr>";echo "<td class=\"TDMain\" width=\"75\">NB#</td>";echo "<td class=\"TDMain\" width=\"125\">Author</td>";echo "<td class=\"TDMain\" width=\"225\">Subject Matter</td>";echo "<td class=\"TDMain\" width=\"75\">Date Created</td>";echo "</tr>";while ($row = mysql_fetch_array($result)){ 	echo "<tr>";	echo "<td class=\"TDText\"><span style=\"cursor: pointer;\" id=\"nb_control".$nb."\" onclick=\"showHideMenu('nb_control".$nb."','JumpMenu".$nb."')\"><a href=\"javascript:void(0);\">$row[nb_number]</a></span>";	echo "<div id=\"JumpMenu".$nb++."\" style=\"display: none;\">";	echo "<table id=\"TblJumpMenu\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_edit.php?nbid=$row[nb_id]\"><strong>Edit $row[nb_number]</strong></a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_issue.php?nbid=$row[nb_id]\">Issue $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_return.php?nbid=$row[nb_id]\">Reference In $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_reissue.php?nbid=$row[nb_id]\">Reference Out $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_audit.php?nbid=$row[nb_id]\">Audit $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_archive.php?nbid=$row[nb_id]\">Archive $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_expire.php?nbid=$row[nb_id]\">Expire $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td class=\"JumpMenu_Content\"><a href=\"nb_destroy.php?nbid=$row[nb_id]\">Destroy $row[nb_number]</a></td>";	echo "</tr>";	echo "<tr>";	echo "<td id=\"Last\" class=\"JumpMenu_ContentLast\"><a href=\"../logs/log_history.php?nbid=$row[nb_id]\">View $row[nb_number] History</a></td>";	echo "</tr>";	echo "</table>";	echo "</div>";	echo "<script type=\"text/javascript\">registerPopup('JumpMenu".$jm++."');</script>";	echo "</td>";	echo "<td class=\"TDText\">$row[nb_auth]</td>";	echo "<td class=\"TDText\">$row[nb_subject]</td>";	echo "<td class=\"TDTextLast\">$row[issue_date]</td>";	echo "</tr>";}echo "</table>";