Search the Community
Showing results for tags 'search engine'.
-
Hi, I'm looking for a programmer to fix my search engine script. If interested, please go to www.shoppersplace.com and check out the buffering, header, errors at the top of the page of this search engine. try a few searches and see the errors. thank you.
-
- php
- search engine
-
(and 1 more)
Tagged with:
-
GOOD DAY phpfreaks.com Can Anyone Help about my code. My search engine can search and display if there is no user logged-in, but it goes wrong when it have user logged-in ? //The Error Shown Every time I have user Loginerror.txt Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\pagong\ProgramFiles\wamp\www\mandaya\pages\modifier\search.php on line 103 //The Search Form search-form.txt <form action="search.php" method="get" id="form1" name="form1" > <input name="keysearch" type="text" value="<?php echo $_GET['keysearch']; ?>" size="30" height="30px" placeholder="Search Mandaya Topics" id="s_box" /> <input type="submit" value="SEARCH" class="s_in"/> </form> // my php search code searchcode.txt <?php $keysearch = $_GET['keysearch']; $keysearch = filter_var($_GET['keysearch'], FILTER_SANITIZE_STRING); $keysearch = htmlspecialchars($_GET['keysearch']); $terms = explode(" ", $keysearch); $query = "Select * from images Where "; foreach ($terms as $each){ $i++; if ($i==1) $query .= "search like '%$each%' "; else $query .= "Or search like '%$each%' "; } //connect mysql_connect("localhost", "root"); mysql_select_db("mandaya"); //Done if Search is filled if(!empty($keysearch)){ $query = mysql_query($query); //Execute the query $query $numrows = mysql_num_rows($query); //Count the result of query //Get the DB fields from query if ($numrows > 0 ){ //Set each other while ($row = mysql_fetch_assoc($query)){ $id_topic = $row ['id_img']; $title = $row ['title']; $description = $row ['description']; $a = $row ['desc_a']; $b = $row ['desc_b']; $c = $row ['desc_c']; $d = $row ['desc_d']; $e = $row ['desc_e']; $link1 = $row ['link1']; $link2 = $row ['link2']; $key = $row ['keywords']; echo "<ul class='image_list'> <li><form method='POST' action='index.php'> <input type='hidden' name='topic' value='$id_topic'/> <input type='hidden' name='title' value='$title'/> <input type='image' name='img' value='$link1' src='$link1' size='100px' height='100px' title='$title'/> <input type='hidden' name='desc' value='$description'/> <input type='hidden' name='desc_a' value='$a'/> <input type='hidden' name='desc_b' value='$b'/> <input type='hidden' name='desc_c' value='$c'/> <input type='hidden' name='desc_d' value='$d'/> <input type='hidden' name='desc_e' value='$e'/> <input type='hidden' name='key' value='$key'/> <input type='hidden' name='image1' value='$link1'/> <input type='hidden' name='image' value='$link2'/> </form></li> </ul>"; } } else echo " <center>No results found for \"<b>$keysearch</b>\""; } //disconnect mysql_close(); ?>
-
Hello, I made a search engine and now I am trying to find an open source spider for its. I have a database phpmyadmin, where are around 200 urls, descriptions, titles and keywords and now I want connect it with spider to add more results in it.
- 2 replies
-
- crawler
- search engine
-
(and 2 more)
Tagged with:
-
Hello. Im fairly new to php but i like to think im reasonably competent. To set the scene, ive got a website that displays, for simplicity, images. I also have some scripts that show this in a paginated form when they get above x number. If i merely had a blank page(s) with lists of images that broke into new page every 25th image then my script could handle that without an issue. However, as you may have already guessed, it is not just quite as simple as that. I also have a search function on this page. As a separate entity it works very well, and its able to search the database correctly for the search terms. It can also show the data in paginated form - ie, if i have 24 images selected from the search terms then it will show that there is only 1 page, if my settings dictate a page break on the 25th image. The issue arises in a few scenarios: a) if someone has searched, is given a page of results, and then clicks the "1st page" link the pagination scripts create, then the search is lost and it returns to the complete list of unfiltered images. b) If I have more than, for example 27 images (ie a need for TWO pages post search), then when someone clicks the "2nd page" link, instead of seeing page 2 of the searched for images, they see page two of the unfiltered image, ie, it seems that the script is unable to carry the search terms across pages and act upon them. So, in simple form, I have a pagination script that paginates, and a search function that searches, but im having trouble integrating them both. Below are my scripts: This creates the page numbers at the bottom: (NB i have tried to alter the link url by appending both page number and the "lookup" (search terms). <?php if ($totalcountplus >= 1 && $page <= $totalcountplus) { for ($x = 1; $x<=$totalcountplus; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'&?lookup='.$searchword.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'&?lookup='.$searchword.'">'.$x.'</a> ';}} ?> Here we have the actual script that sorts the pagination: <?php $searchword = $_GET['lookup']; $expsearchword = explode(" ", $searchword); $searchquery = "SELECT DISTINCT user_id FROM `images` WHERE "; $searchquerytwo = "SELECT COUNT(DISTINCT user_id) FROM images WHERE "; foreach ($expsearchword as $item) { $t++; if ($t == 1) $searchquery .= "`description` LIKE '%$item%' OR `keywords` LIKE '%$item%'"; else $searchquery .= "OR `description` LIKE '%$item%' OR `keywords` LIKE '%$item%'"; } foreach ($expsearchword as $item) { $r++; if ($r == 1) $searchquerytwo .= "`description` LIKE '%$item%' OR `keywords` LIKE '%$item%'"; else $searchquerytwo .= "OR `description` LIKE '%$item%' OR `keywords` LIKE '%$item%'"; } $per_page = 25; $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $per_page; $totalcount = mysql_query($searchquerytwo); $totalcountarray = mysql_fetch_array($totalcount); $totalcountplus = ceil(mysql_result($totalcount, 0) / $per_page); $totalcountone = mysql_query("$searchquery LIMIT $start, $per_page"); while($totalcountplusone = mysql_fetch_array($totalcountone)) { ; $usercountone =$totalcountplusone['0']; } ?> I also have this while loop running on another page. its here for info only, and i dont think its contributing to my issues: $allimagesone = mysql_query("$searchquery LIMIT $start, $per_page"); while($airesult = mysql_fetch_assoc($allimagesone)) { ETC ETC ETC ; } ?> I know this is pretty long winded but i hope you guys can help me out because im a real loss as to how to combine the two functions successfully. Basically i think it boils down to getting the url to "remember" both the page number AND the search terms, and im not quite sure how to do that successfully. All advice is welcome, thanks in advice.
- 3 replies
-
- php
- search engine
-
(and 1 more)
Tagged with: