new page after result page like "thescripts"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skuer
    New Member
    • Feb 2008
    • 13

    new page after result page like "thescripts"

    Hey people..

    I'm trying to find out how i can click on a result page after a search, so it can show the result more detailed in new a page.

    Is this possible?

    All the user datas is stored in a mysql table..
    So do i have to send theese datas into separates html/php pages, before the users can search after it?

    The idea is much like "thescripts " page..where you serach first and then you can click on the link to read the question and comments..

    Any idea or code help?
    Skuer
  • MarkoKlacar
    Recognized Expert Contributor
    • Aug 2007
    • 296

    #2
    Hi,

    What you need to do is keep track of what thread a particular entry is for and all you threads, using an id is probably the most common.

    After this you can display the thread information and provide the user with a link that will get all the entries with the same id as the thread.

    Hope I'm clear enough, if not let me know.

    Good luck

    Comment

    • skuer
      New Member
      • Feb 2008
      • 13

      #3
      Originally posted by MarkoKlacar
      Hi,

      What you need to do is keep track of what thread a particular entry is for and all you threads, using an id is probably the most common.

      After this you can display the thread information and provide the user with a link that will get all the entries with the same id as the thread.

      Hope I'm clear enough, if not let me know.

      Good luck
      Hey..

      I tried to understand this after reading it several times, but i still don't get it:S

      If You're talking about threads like there are in a forum, i don't got that on my page.
      Would it be bether to automaticly make different html/php pages after the submit from the user, that contains the data from the table?

      Skuer..

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Basically, you search your table for the search items entered by the user. For each result you display a link on the screen. That link contains the identifier of the full result (or entry) to be shown. When clicked you are passed that identifier, that you can use to read the full data result and display it.

        A simple program like the following shows this.
        [php]
        // Search.php
        // Search through the table and display each result in a link
        $sql = "SELECT answerid, question FROM questions ".
        " WHERE question REGEXP '$searchword1'" .
        " OR question REGEXP '$searchword2'" .
        " ORDER BY question";
        $result=mysql_q uery($sql) or die("SELECT error: " . mysql_error());
        while ($row=mysql_fet ch_assoc($resul t)) {
        echo '<a href="display.p hp?id='.$row['answerid'].'>'.$row['question'].'</a>';
        }

        // Display.php
        // Called with the answerid in the $_GET array
        $id = $_GET['id'];
        $result=mysql_q uery("SELECT answer FROM answers WHERE id=$id");
        while ($row=mysql_fet ch_assoc($resul t)) {
        echo $row['answer'];
        }
        [/php]
        Drop by when you have more questions.

        Ronald

        Comment

        • skuer
          New Member
          • Feb 2008
          • 13

          #5
          Originally posted by ronverdonk
          Basically, you search your table for the search items entered by the user. For each result you display a link on the screen. That link contains the identifier of the full result (or entry) to be shown. When clicked you are passed that identifier, that you can use to read the full data result and display it.

          A simple program like the following shows this.
          [php]
          // Search.php
          // Search through the table and display each result in a link
          $sql = "SELECT answerid, question FROM questions ".
          " WHERE question REGEXP '$searchword1'" .
          " OR question REGEXP '$searchword2'" .
          " ORDER BY question";
          $result=mysql_q uery($sql) or die("SELECT error: " . mysql_error());
          while ($row=mysql_fet ch_assoc($resul t)) {
          echo '<a href="display.p hp?id='.$row['answerid'].'>'.$row['question'].'</a>';
          }

          // Display.php
          // Called with the answerid in the $_GET array
          $id = $_GET['id'];
          $result=mysql_q uery("SELECT answer FROM answers WHERE id=$id");
          while ($row=mysql_fet ch_assoc($resul t)) {
          echo $row['answer'];
          }
          [/php]
          Drop by when you have more questions.

          Ronald
          Wow..

          Thank you very much, will try it as soon as possible

          But just a quick question, so i don't just copy it, but also learning it..

          What's the data in "answerid" and why are you using the " $_GET['id'] " when you're displaying it?


          Many thanks
          Skuer

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            Column answerid? I don't know, it is just an example of how to relate a question in a questions table to an answer to that question in an answers table. This is not a real application, just an example of how you can solve your problem.

            I am afraid you miss some basic knowledge about PHP programming. When you do not know what the $_GET (or $_POST or $_SESSION or $_GLOBALS or $_REQUEST) is, you'd better get some basic education on how scripts can communicate with each other or how they can pass data to each other.

            Ronald

            Comment

            Working...