1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Have all searches caught -> then displayed on a page

Discussion in 'PHP' started by Al Capone, Aug 13, 2005.

  1. #1
    Hi there, this is my first post so I just wanted to say hi first. Anyways here's my problem:
    SEMrush
    I have a search engine, and I want to have all the searches that are made in the search field caught then have them appear on a page. I have seen this done before on other sites and I really think it's quite brilliant, anyways if someone could help me out I would be greatful, thanks.
     
    Al Capone, Aug 13, 2005 IP
    SEMrush
  2. 1-script.com

    1-script.com Well-Known Member

    Messages:
    805
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Not too sure what page you need your search terms to appear on, but if you only need to look at them yourself via a password-protected control panel, you can use this script:
    http://www.1-script.com/1_search/. It collects the search terms in text files (separate for found and not found)
    Oh, BTW, the script is written in Perl, not PHP.

    Cheers!
    D.
     
    1-script.com, Aug 13, 2005 IP
  3. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I have my own search engine script, I thought that maybe I could just slip in a line of text to the search field and add a script or two and it would make the searches be record and generated on a page. Please help me or tell me if this is possible or not, thanks.
     
    Al Capone, Aug 13, 2005 IP
  4. JoeO

    JoeO Peon

    Messages:
    431
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It would be pretty simple to write search queries to a database or a text file and then pull them from there.
    Or even write them right into a html page... but that would be a little sloppy.
     
    JoeO, Aug 13, 2005 IP
  5. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Oh, ok thanks for the reply, let me show you what I am trying to do, see this site please:

    w w w . e d c o m p . c o m

    look under the box, there something that says "Site map of all search results" that's what I want to do too. This is really important to me, I tryed searching but I had no luck, if someone could help me I would be extremely greatful, thank you so much.
     
    Al Capone, Aug 13, 2005 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    26,758
    Likes Received:
    4,068
    Best Answers:
    115
    Trophy Points:
    665
    #6
    basically before you search you save the query to a database table with a timestamp. Then you can query on that table for recent searches ordering either by timestamp or id desc.

    I've done that for a client site where they have a custom search utility. Works well.

    Sarah
     
    sarahk, Aug 14, 2005 IP
  7. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #7
    Yeah or by alphabet, I know it's possible but is this the right place to get help? I am new here, I just need someone to tell me what I need to do to get this done please. I get it though, it needs to save in databases first then direct to the page (from what you said) I just don't know what script to use, I have mySQL and everything though thanks again. So again if someone could tell me the steps I should take or what I should do to get this accomplished I would be greatful.

    Thank you extremely much in advance, you can't imagine how much this means to me.

    Thanks again.
     
    Al Capone, Aug 14, 2005 IP
  8. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #8
    Someone think they can help me out here please? It would mean the world to me, thanks :)
     
    Al Capone, Aug 14, 2005 IP
  9. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #9
    This will have to be programmed into your existing script by someone who will not break the existing script in the process. You will either need to

    a. Pay someone to add the capability to your script.

    b. Learn PHP and change the script yourself.

    I can tell you that what you are wanting to do is actually pretty easy and would take between 45 minutes and an hour to program barring any issues with the existing script.
     
    palespyder, Aug 14, 2005 IP
  10. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #10
    I am only 16, so money is an issue. But it would be nice if someone could point me in the right direction, e.g. a tutorial for this type of script or something or even just tell me what I am trying to do is called so I can search for it, I have been searching for "script that lets you cache search results and display them" and I haven't had much luck at all, so if it has a name I could search for it easier, thanks!
     
    Al Capone, Aug 14, 2005 IP
  11. mck9235

    mck9235 Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Ok, here we go. :)
    
    <?php
    //The following should be added after a search, to add it to the DB, also have the DB connected
    $query = $_POST['searchfield'];
    $time = time();
    $ftime = date("F j Y g:i A");
    mysql_query("INSERT INTO `table` (`query`, `time`, `ftime`) VALUES ('$query', '$time', '$ftime')") or die(mysql_error());
    //Now for the displaying stuff
    $getit = mysql_query("SELECT * FROM `table` ORDER BY `time` DESC") or die(mysql_error());
    while($get = mysql_fetch_array($getit))
    {
    $query = $get['query'];
    $time =  $get['time'];
    $ptime = $get['ptime'];
    echo("$query - $ptime - $time");
    }
    ?>
    
    PHP:
    Check out http://www.pixel2life.com for tutorials.
     
    mck9235, Aug 14, 2005 IP
    JoeO likes this.
  12. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #12
    Thank you SOO much but do you have the full page of the tutorial for this one? Like direct link please, thanks SOOO much.
     
    Al Capone, Aug 14, 2005 IP
  13. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #13
    Do you have the page you found this from because I keep getting database not found, I entered the database name where it says `table` I suspect thats what I did wrong but I can't be sure.

    Please help me, thanks :)
     
    Al Capone, Aug 15, 2005 IP
  14. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #14
    Eh ehmm... *BUMP*
     
    Al Capone, Aug 15, 2005 IP
  15. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #15
    Please help me
     
    Al Capone, Aug 16, 2005 IP
  16. daed

    daed Peon

    Messages:
    93
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #16
    He posted the link to the tutorial below the code.. but if you could be more specific and paste what code you're using and the exact error, as well as your table/database layout.. Diagnosing would be a lot easier.
     
    daed, Aug 16, 2005 IP
  17. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #17
    Ya know instead of wasting space bumping your thread, you could either wait till someone answers you, or god forbid, look for the information yourself on G**gle. This is like asking for help with homework and then telling the person you will be back when it is finished, damn man, do your own legwork for cripes sake.
     
    palespyder, Aug 16, 2005 IP
  18. Al Capone

    Al Capone Well-Known Member

    Messages:
    784
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    140
    #18
    I'm sorry man, I tried to use what he posted, thing is, I get database not connected message.
    this is what i did, I put this code
    into the end of the search file, pgn_SEARCH if mySQL database name. then when page loads, on the bottom of the results page it says "database not connected"

    trust me I have looked on google and that link that mck gave me for about 3-4 days now this is all I have been doing for 3-4 days, I had absolutly no luck at all, if someone has a link or something for the tutorial on this or knows whats wrong, please help me, I have gone on almost a solid week with no luck whatsoever.

    I would be extremely greatful for anyones help, thank you VERY much

    - John

    P.S.: Whoever is responsible for helping me do this will get $10 via pay pal, I am onluy 16, thats all I can afford, but its quick cash through pay pal if you are responsible for helping me do this.

    thanks again.
     
    Al Capone, Aug 16, 2005 IP
  19. mck9235

    mck9235 Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Alright, the table is not the database. The table is the name of the table you created in PHPMyAdmin, or something of that sort. Look at the link I gave you, then goto the PHP category and look for mySQL tutorials, theres tons of good information there. :)
     
    mck9235, Aug 16, 2005 IP
  20. JoeO

    JoeO Peon

    Messages:
    431
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Before you go any further I recommend you learn how to simply read and write to a MySQL database using php... Once you have the basics down the rest will be a lot more clear.
     
    JoeO, Aug 16, 2005 IP