merhaba php ve full text search hatalarını hallettim suan arama calışıyor ama bazı 3-4 sonuclu aramalarda sayfa numaraları cıkıyor, mesela bazı aramalarda sonuc cıkmaz ise yerine 25 rastgele oyun basıyorum bazı aramalarda bu rastgele 25 oyun bazen gelmiyor yardımcı olabilirseniz sevinirim.
http://www.zenoyun.com/Oyunlari/scooby-sayi-oyunu
mesela bunda hiç sonuc yok sayfa numaraları var
sonuc olmadığı zaman rastgele 25 oyun dönmesi gerekiyor ama yok
mesela bu arama sonucu normal
http://www.zenoyun.com/Oyunlari/raccoon-yarislari
burdada normal olarak sonucu olmayan arama için 25 rastgele sonuc döndürüyor
http://www.zenoyun.com/Oyunlari/limunes
kısacası sapıttı script
Search.php kodları:
Alıntı
<?php
// Display games
function searchgames($page,$searchTerm) {
global $siteurl, $filesperpage, $sefriendly, $resimler;
$result = mysql_query("SELECT * FROM files WHERE match(title, description)against('$searchTerm') && status ='1'");
if(empty($searchTerm)) {
echo "Site adi";
} else {
echo $searchTerm;
}
if (mysql_num_rows($result) == '0') {
echo " kelimesi geçen oyunlar listeleniyor.";
$result2 = mysql_query("SELECT * FROM files order by rand() desc limit 22");
$fileinrow="1";
while($row = mysql_fetch_array($result2)) {
$fileid = $row['fileid'];
$filetitle = $row['title'];
$filerating = $row['rating'];
$filedescription = $row['description']." oyunları, ".$row['description']." flash oyunları, ".$row['description']." kral oyun, ".$row['description']." oyunlar oyna,";
$fileicon = $row['icon'];
$iconlocation = $row['iconlocation'];
$timesplayed = number_format($row['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $resimler.$fileicon;
} else {
$imageurl = $fileicon;
}
if (strlen($filedescription) > '40') {
$filedescription = substr("$filedescription",0,37)."...";
}
if ($fileinrow == '1') {
echo "<tr>";
}
$fileinrow="1";
while($row = mysql_fetch_array($result2)) {
$fileid = $row['fileid'];
$filetitle = $row['title'];
$filedescription = $row['description']." oyna, ".$row['description']." flash oyunları, ".$row['description']." kral oyun, ".$row['description']." oyna,";
$fileicon = $row['icon'];
$iconlocation = $row['iconlocation'];
$timesplayed = number_format($row['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $resimler.$fileicon;
} else {
$imageurl = $fileicon;
}
if (strlen($filedescription) > '40') {
$filedescription = substr("$filedescription",0,37)."...";
}
if ($fileinrow == '1') {
echo "<tr>";
}
?>
<td width="33%">
<table class="browsegamesbox">
<tr>
<td width="71" valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self"><img src="<?php echo $imageurl; ?>" title="<?php echo $filetitle; ?> oyna" width="70" height="59" ALT="<?php echo $filetitle; ?>" border="0"></a>
</td>
<td valign="top">
<a title="<?php echo $filetitle; ?> oyunu" href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self" class="gamelink"><?php echo $filetitle; ?></a><br />
<?php echo $filedescription; ?><br />
<span class="Toplam-oynanan-oyun">(Oynanma: <?php echo $timesplayed; ?> Kez)</span>
<img src="<?php echo $siteurl; ?>/images/stars<?php echo $filerating; ?>.gif" border="0" width="60" height="10" alt="<?php echo $filerating; ?>" title="<?php echo $filerating; ?>">
</td>
</tr>
</table>
<?php
if ($fileinrow == '3') {
echo "</tr>";
$fileinrow = "0";
}
$fileinrow++;
}
if ($fileinrow == '2') {
echo "<td width=\"33%\"></td><td width=\"33%\"></td></tr>";
} elseif ($fileinrow == '3') {
echo "<td width=\"33%\"></td></tr>";
}}
} else {
// Get number of pages
$numrows = mysql_num_rows($result);
$offset = ($page - 1) * $filesperpage;
$pagescount = ceil($numrows/$filesperpage);
for ($pagen = 1; $pagen <= $pagescount; $pagen++) {
if ($pagen == $page) {
$nav .= " <b>$pagen</b>";
} else {
$nav .= " <a href=\"".$siteurl."/index.php?action=search&t=".$searchTerm."&page=".$ pagen."\">$pagen</a>";
}
}
if ($page > 1) {
$pagen = $page - 1;
$prev = "<a href=\"".$siteurl."/index.php?action=search&t=".$searchTerm."&page=".$ pagen."\">< Previous</a>";
} else {
$prev = "";
}
if ($page < $pagescount) {
$pagen = $page + 1;
$next = " <a href=\"".$siteurl."/index.php?action=search&t=".$searchTerm."&page=".$ pagen."\">Next ></a>";
} else {
$next = "";
}
// Display page numbers
if ($pagescount > '1') {
echo "<tr><td colspan='3' class='pagenumbers'>".$prev.$nav.$next."</td></tr>";
}
$result2 = mysql_query("SELECT title, icon, iconlocation, fileid, description, rating, timesplayed FROM files WHERE title LIKE '%$searchTerm%' && status ='1' || description LIKE '%$searchTerm%' && status ='1' ORDER BY title LIMIT $offset, $filesperpage");
$fileinrow="1";
while($row = mysql_fetch_array($result2)) {
$fileid = $row['fileid'];
$filetitle = $row['title'];
$filerating = $row['rating'];
$filedescription = $row['description'];
$fileicon = $row['icon'];
$iconlocation = $row['iconlocation'];
$timesplayed = number_format($row['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $resimler.$fileicon;
} else {
$imageurl = $fileicon;
}
if (strlen($filedescription) > '40') {
$filedescription = substr("$filedescription",0,37)."...";
}
if ($fileinrow == '1') {
echo "<tr>";
}
?>
<td width="33%">
<table class="browsegamesbox">
<tr>
<td width="71" valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self"><img src="<?php echo $imageurl; ?>" width="70" height="59" title="<?php echo $filetitle; ?>" border="0"></a>
</td>
<td valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self" class="gamelink"><?php echo $filetitle; ?></a><br />
<?php echo $filedescription; ?><br />
<span class="Toplam-oynanan-oyun">(Oynanma: <?php echo $timesplayed; ?> Kez)</span>
<img src="<?php echo $siteurl; ?>/images/stars<?php echo $filerating; ?>.gif" border="0" width="60" height="10" alt="<?php echo $filerating; ?>" title="<?php echo $filerating; ?>">
</td>
</tr>
</table>
<?php
if ($fileinrow == '3') {
echo "</tr>";
$fileinrow = "0";
}
$fileinrow++;
}
if ($fileinrow == '2') {
echo "<td width=\"33%\"></td><td width=\"33%\"></td></tr>";
} elseif ($fileinrow == '3') {
echo "<td width=\"33%\"></td></tr>";
}
// Display page numbers
if ($pagescount > '1') {
echo "<tr><td colspan='3' class='pagenumbers'>".$prev.$nav.$next."</td></tr>";
}
}
}
?>