Professional Web Applications Themes

Making links via mysqldatabase!!! - PHP Development

Hi i have the following problem and i am breaking my mind on it: I have a mysql database with (id,title,topic,body) in the database i have stored some doents. How can i display a link with only the title of the doent stored?(easy one) but... I want to view the whole doent in the same page! Let me explain in code: <?php $ip = "localhost"; $user = "kostas"; $password = "kostas"; $basename = "test"; $table ="docs"; $db = mysql_connect($ip, $user, $password); mysql_select_db($basename,$db); $result1= mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5 "); $myrow = mysql_fetch_array($result1); $title = $myrow["title"]; ...

  1. #1

    Default Making links via mysqldatabase!!!

    Hi i have the following problem and i am breaking my mind on it:
    I have a mysql database with (id,title,topic,body) in the database i have
    stored some doents.
    How can i display a link with only the title of the doent stored?(easy
    one) but...
    I want to view the whole doent in the same page!
    Let me explain in code:

    <?php
    $ip = "localhost";
    $user = "kostas";
    $password = "kostas";
    $basename = "test";
    $table ="docs";
    $db = mysql_connect($ip, $user, $password);
    mysql_select_db($basename,$db);
    $result1= mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5 ");
    $myrow = mysql_fetch_array($result1);
    $title = $myrow["title"];
    $intro = $myrow["intro"];
    $body = $myrow["body"];
    ?>

    So i want the five latest entries to be as links in a blank page and each
    time a link is pressed i want to show the whole corresponding doent
    (title,intro,body) in the same page.
    Thanks a lot
    [email]karbanitee.duth.gr[/email]


    Kostas Guest

  2. #2

    Default Re: Making links via mysqldatabase!!!

    "Kostas" a écrit le 26/11/2003 :
    > Hi i have the following problem and i am breaking my mind on it:
    > I have a mysql database with (id,title,topic,body) in the database i have
    > stored some doents.
    > How can i display a link with only the title of the doent stored?(easy
    > one) but...
    Do a loop to p through the returned rows
    > I want to view the whole doent in the same page!
    Test for a argument in the URL for example.
    > Let me explain in code:
    >
    > <?php
    > $ip = "localhost";
    > $user = "kostas";
    > $password = "kostas";
    > $basename = "test";
    > $table ="docs";
    > $db = mysql_connect($ip, $user, $password);
    > mysql_select_db($basename,$db);
    > $result1= mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5 ");
    while ($current_row = mysql_fetch_assoc ($result1)) //For each of the 5
    rows returned
    {
    $current_id = $current_row[id];
    $current_title = $current_row[title]; //We don't need
    more info

    echo "<a
    href='$_SERVER[PHP_SELF]?doc=$current_id'>$current_title</a><br>\n";
    }

    if (isset ($_GET[doc])) //Test if an link
    as been clicked
    {
    $result2 = mysql_query ("SELECT * FROM $table WHERE id='$_GET[id]'");
    $returned_doc = mysql_fetch_assoc ($result2); //Get the data from
    the DB

    echo "Title : $returned_doc[title]<br>\n";
    echo "Intro : $returned_doc[intro]<br>\n";
    echo "Body : $returned_doc[body]";
    }
    > ?>
    >
    > So i want the five latest entries to be as links in a blank page and each
    > time a link is pressed i want to show the whole corresponding doent
    > (title,intro,body) in the same page.
    > Thanks a lot
    > karbanitee.duth.gr

    Jedi121 Guest

Similar Threads

  1. Making links relative to site root
    By jestre in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: October 4th, 09:48 PM
  2. Making links to word doents (.doc)
    By tech_E in forum Dreamweaver AppDev
    Replies: 1
    Last Post: April 6th, 06:23 PM
  3. Making map links
    By discman webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 17th, 02:48 AM
  4. Making links from text in a database
    By LotusAndy webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 16th, 09:58 AM
  5. making links not blue?
    By Chris Jumonville in forum Adobe Dreamweaver & Contribute
    Replies: 12
    Last Post: July 15th, 12:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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