Jump to content

search


ctcp

Recommended Posts

<form method="GET" action="">
  <input name="query" type="text" id="boxy" value="<? if (isset($query)) echo $query; ?>" size="50"/>
  <label for="type"></label><select name="type" id="type">
    <option value="Games" <?php if (!(strcmp("Games", "$type"))) {echo "selected=\"selected\"";} ?>>Games</option>
    <option value="Movies" <?php if (!(strcmp("Movies", "$type"))) {echo "selected=\"selected\"";} ?>>Movies</option>
  </select>
  <button type="submit">Search</button>
       </form>

<?php

$results = mysql_query("SELECT * FROM crackz WHERE `option` = 'yes'  and name LIKE '%". $query ."%' and `type` = '$type' ORDER BY date DESC LIMIT $page, $limit");
while ($data = mysql_fetch_array($results))
{
?>
[<a href="?type=<?=$data["type"]?>"><?=$data["type"]?></a>] | <a href="<?=$data["site_url"]?>"target="_blank" title="<?=$data["name"]?>"><?=$data["name"]?></a> <br>
<?=$data["date"]?> <br>
<br>

  <?
}
?>

 

how to search All (games movies)

 

Link to comment
Share on other sites

<?php
$connect = ($dsn);

if (!($connect)) // If no connect, error and exit().
{
echo("<p>Unable to connect to the database server.</p>");
exit();
}

if (!(@mysql_select_db($database_files))) // If can't connect to database, error and exit().
{
echo("<p>Unable to locate the $db_name database.</p>");
exit();
}

if (!($limit)){
$limit = 25;} // Default results per-page.
if (!($page)){
$page = 0;} // Default page value.
$numresults = mysql_query("SELECT * FROM crackz WHERE `option` = 'yes'  and `type` = '$type' and name LIKE '%". $query ."%'"); // the query.
$numrows = mysql_num_rows($numresults); // Number of rows returned from above query.


$pages = intval($numrows/$limit); // Number of results pages.

// $pages now contains int of pages, unless there is a remainder from division.

if ($numrows%$limit) {
$pages++;} // has remainder so add one page

$current = ($page/$limit) + 1; // Current page number.

if (($pages < 1) || ($pages == 0)) {
$total = 1;} // If $pages is less than one or equal to 0, total pages is 1.

else {
$total = $pages;} // Else total pages is $pages value.

$first = $page + 1; // The first result.

if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
$last = $page + $limit;} //If not last results page, last result equals $page plus $limit.

else{
$last = $numrows;} // If last results page, last result equals total number of results.

//escape from PHP mode.
?>
<html>
<head>
<title>Search Results for <?=$query?></title>
</head>
<body>
<left></left>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
   <td align="left">   <div class="searchy">
     <form method="GET" action="">
  <input name="query" type="text" id="boxy" value="<? if (isset($query)) echo $query; ?>" size="50"/>
  <label for="type"></label><select name="type" id="type">
    <option value="Games" <?php if (!(strcmp("Games", "$type"))) {echo "selected=\"selected\"";} ?>>Games</option>
    <option value="Movies" <?php if (!(strcmp("Movies", "$type"))) {echo "selected=\"selected\"";} ?>>Movies</option>
  </select>
  <button type="submit">Search</button>
       </form>
</div>
</td>
  </tr>
<tr>
   <td align="right" bgcolor="#F0F8FF">
      <?php if ($numrows > 0) { ?>
    Results
<?=$first?>
     - 
    <?=$last?>
    about <strong></strong>
    <?=$numrows?>
    <?php if ($numrows > 0) { ?> 
    <? if (isset($query) ) {if (!count($results) > 0) echo "for: $query";}}?>    Page
<?=$current?>
    of
<?=$numrows?>
   </td>
   <? } ?>
  </tr>
</table>
<table width="100%" border="0">
  <tr>
    <td width="33%" nowrap scope="col"> </td>
    <td width="33%" align="center" nowrap scope="col">  
<?
if ($page != 0) { 
$back_page = $page - $limit;
echo("<a href=\"$PHP_SELF?&query=$query&type=$type&page=$back_page&limit=$limit\">Back</a>    \n");}


$p = $page/$limit+1;
$start = max(1,min($p-5, $pages-10));
$end = min($pages, max($p+5, 10));

for ($i=$start; $i <= $end; $i++) 
{
$ppage = $limit*($i - 1);
if ($ppage == $page){
echo("<b>$i</b> \n");} 
else{
echo("<a href=\"$PHP_SELF?&query=$query&type=$type&page=$ppage&limit=$limit\">$i</a> \n");}
}


if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { 
$next_page = $page + $limit;
echo("    <a href=\"$PHP_SELF?&query=$query&type=$type&page=$next_page&limit=$limit\">Next</a>\n");}
?></td>    
  <?php if ($numrows > 0) { ?>
    <td width="34%" align="right" nowrap scope="col">Results per-page: <a href="<?=$PHP_SELF?>?query=<?=$query?>&type=<?=$type?>&page=<?=$page?>&limit=25">25</a> | <a href="<?=$PHP_SELF?>?query=<?=$query?>&type=<?=$type?>&page=<?=$page?>&limit=50">50</a> | <a href="<?=$PHP_SELF?>?query=<?=$query?>&type=<?=$type?>&page=<?=$page?>&limit=100">100</a></td>
<? } ?>
  </tr>
</table>
<?

$results = mysql_query("SELECT * FROM crackz WHERE `option` = 'yes'  and name LIKE '%". $query ."%' and `type` = '$type' ORDER BY date DESC LIMIT $page, $limit");
while ($data = mysql_fetch_array($results))
{
?>
[<a href="?type=<?=$data["type"]?>"><?=$data["type"]?></a>] | <a href="<?=$data["site_url"]?>"target="_blank" title="<?=$data["name"]?>"><?=$data["name"]?></a> <br>
<?=$data["date"]?> <br>
<br>

  <?
}
?>
<?php if ($numrows == 0) { ?>
<? if (isset($numbs) || isset($query) || isset($crackidnum)) {
if (!count($results) > 0)
	  echo "<h4>LinksCopy</h4>";
  echo "<h4><p>Sorry, your search: $query; ". $trimmed . "returned zero results</p>";
}}?>  
</p>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.