+ Reply to Thread
Results 1 to 2 of 2

Thread: Help help! Need help!

  1. #1
    thesearc is offline x10Hosting Member thesearc is an unknown quantity at this point
    Join Date
    Jan 2012
    Posts
    1

    Help help! Need help!

    Hey guys this is my first time posting on forms. I am making a search engine and I really need help because the search results are not going up when I try to search on my site. Here is the sample code I used:


    <?php$button = $_GET ['submit'];$search = $_GET ['search']; if(!$button)echo "you didn't submit a keyword";else{if(strlen($search)<=1)echo "Search term too short";else{echo "You searched for <b>$search</b> <hr size='1'></br>";mysql_connect("localhost","your mysql username","password");mysql_select_db("your database name");$search_exploded = explode (" ", $search);foreach($search_exploded as $search_each){$x++;if($x==1)$construct .="keywords LIKE '%$search_each%'";else$construct .="AND keywords LIKE '%$search_each%'";}$construct ="SELECT * FROM searchengine WHERE $construct";$run = mysql_query($construct);$foundnum = mysql_num_rows($run);if ($foundnum==0)echo "Sorry, there are no matching result for <b>$search</b>.</br></br>1. Try more general words. for example: If you want to search 'how to create a website' then use general keyword like 'create' 'website'</br>2. Try different words with similar meaning</br>3. Please check your spelling";else{echo "$foundnum results found !<p>";while($runrows = mysql_fetch_assoc($run)){$title = $runrows ['title'];$desc = $runrows ['description'];$url = $runrows ['url'];echo "<a href='$url'><b>$title</b></a><br>$desc<br><a href='$url'>$url</a><p>";}}}}?>

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Help help! Need help!

    When asking for help:
    • Use meaningful, specific subject headers
    • Please use [php], [html] or [code] tags (as appropriate) to separate and format code.
    • Say what you expect to happen and what actually happens, including any error messages.

    Make sure you follow these instructions, as well as those in my sig.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers