Topic: Problem with the search box

Hey there!
My search box is not working. When I try to search something, it doesn't return any result.

The code I'm using for the search box is:

<!-- The Quick Search Form -->
<form method="post" action="artigo.php?subaction=search">
<input type="text" name="story" size="24">
<input type="hidden" name="do" value="search">
</form>
<!-- End of the Search Form -->


artigo.php is the page where the full story texts appear

And the code I'm using to show the news is:

<?php
$number="10";
$template="Principal";
$only_active=TRUE;
$start_from="3";
$PHP_SELF = 'artigo.php';
if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("/home/a7334692/public_html/cutenews/search.php"); }
else{ include("/home/a7334692/public_html/cutenews/show_news.php"); }
?>

Re: Problem with the search box

The search can be not displayed because of installed $start_from = 3. If the results are numbered less then 3 so they are not displayed.

Best regards,
CN Support team

3 (edited by 2013-07-23 01:29:31)

Re: Problem with the search box

Thanks a lot! But what code should I use if I want the news to start from 3 and the search to start from 1?

Updated: Now I could do it, but I have another problem: the search is not working well. Sometimes it finds the results I want and sometimes it doesn't. Depends on the expression I'm looking for. It also happens with the example2.php.

Re: Problem with the search box

1. The number of news start_from etc. is programmed by yourself so you can make your own conditions after $_GET['dosearch']
2. The search works with the regular phrases and shows even partly coincided results.

Best regards,
CN Support team

5 (edited by 2013-08-04 13:58:46)

Re: Problem with the search box

2. The search works with the regular phrases and shows even partly coincided results.

I will disagree with you.

renato is right, the search functions sometime finds the results which I want and sometime it doesn't. For example, if I have a news title called "Final Judgement", and I typed in judgement into the search box, it wouldn't show the result at all. This happened to the example2.php search too.

Re: Problem with the search box

if I have a news title called "Final Judgement", and I typed in judgement into the search box, it wouldn't show the result at all

The search is case dependent. 'Judgement' is not the same as 'judgement'.
Read this to change it:
https://cutephp.com/forum/index.php?s=&amp;...st&amp;p=156308

Re: Problem with the search box

Hi Damoor,

Thanks for replying. I have tried the code that has been posted which is this,

// Actual search result?
                    if (preg_match("~$preg_author~i", $item[1]) == 0 ||
                        preg_match("/$preg_title/i", $item[2]) == 0 ||
                        preg_match("/$preg_story/i", $item[3]) == 0)
                        continue;

Indeed the search works a little better than before. However there are some stuff that still doesn't work. For example, I have a title called "Testing CKEditor Config", and when I key in Testing or testing, it wouldn't display the result.

In addition somehow the search result will also show news that doesn't have the keyword within the search. For example I have a news title called Smile and I keyed in Final Fantasy it gave me the topic Smile too (take note that within the Smile news post, there is not even a single Final Fantasy word inside).

Any idea why is this so?