Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default link-question

    Hi ( and I'm sorry in advance ),
    I have looked in php.net but I can't figure out how it's done.
    I want to show a list of the three latest inserted posts in a mysql-table.
    The list is meant to be an apertizer and the users have to click on it to
    see the whole output from the DB.
    How do I make the link to open that exact post?

    Here is what is working for now:

    <?php

    $link = mysql_connect("server", "user", "pass")
    or die("Could not connect: " . mysql_error());
    print ("Connected successfully");
    mysql_select_db("database");
    $result = mysql_query("SELECT ID, tekst, DATE_FORMAT(dato, '%d %m %Y
    kl. %H:%i')as dato FROM henriks ORDER BY ID desc LIMIT 0,3");
    while ($raekke = mysql_fetch_array($result)){

    echo"<P> ID: ".$raekke['ID']."<br>";
    $text = $raekke['tekst'];

    echo"Tekst: ".nl2br(substr($text,0,50))."....";
    echo"<BR>Dato: ".$raekke['dato'];
    }

    ?>

    Regards Ricki


    Ricki Susic Guest

  2. Similar Questions and Discussions

    1. web link question
      Is there a way to create web links in Acrobat Professional so they open the URL in the default browser? I can only seem to get it to work as a...
    2. Button Link Question
      I've created a button with a jpeg and want to be able to click on it and go to FOX News.com I can't seem to get it to work. How do I link it? ...
    3. Pop-Up Menu Link Question
      Hello guys/gals - Only just started using FW so please go easy on me... Have just created my pop up menu sucessfuly and all works fine. I have my...
    4. link question
      I have developed a home page that is a different fireworks image than the rest of the pages on the site. The rest of the pages on the site will all...
    5. A link question, a bit OT
      Jane To an image <a href="Rose.jpg">Flower</a> To a page <a href="more.html">New Page</a>
  3. #2

    Default Re: link-question

    >
    > Create another php page that expects the ID as a GET variable
    > as you loop through your dataset (as per your code snippet) do
    > something like the following:
    >
    > print "<a href='showpost.php?id={$raekke["ID"]}'>Some Text</a>";
    >
    > Then showpost.php:
    Offcourse; it seems obvious. Thank you!

    Ricki


    Ricki Susic Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139