Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Sana'a
    Posts
    183

    A php/mysql question

    Hello guys

    I'm making a small article management system for my site. I have no problems inserting articles and displaying the article on any page . Now the problem am having and not seem to know how to fix it is how can I show article summary with the title being a link and under the summary there will be a Read More link which will open the full article .


    e. g

    Article title which is a link
    article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here article summary text here... Read More

    and also displaying like 5 articles in that way .

    so how can I do that ? I appreciate your help

    thanks in advance.

    kooshin

  2. #2
    Join Date
    Apr 2005
    Location
    Canada... EH?!?
    Posts
    149
    the way i would think is to have 2 columns 1 with the short text to show to front page and the other the rest of the body diagram.

    then in the readmore for example link to index.php

    echo "<a href=\"http://test.com/index.php?full=<id number shown here>\">Read More</a>";

    then have a sub procedure:

    PHP Code:
    <? top of page

    function full
    {
    <
    all database connection here>

    $id $_POST["full"];

    $query="SELECT * FROM table WHERE id=" $id ;
    $result=mysql_query($query);

        while (
    $row mysql_fetch_array($result)){

            echo 
    $row["id"];
            echo 
    $row["headline"];
            echo 
    $row["full text"];

        };

    Close connection
    };
    ?>

    <?

    <all database connection here>

    $query="SELECT * FROM table";
    $result=mysql_query($query);

        while (
    $row mysql_fetch_array($result)){

            echo 
    $row["id"];
            echo 
    $row["headline"];
            echo 
    $row["short text"];
            echo 
    "<a href=\"http://test.com/index.php?full=\" .
                 
    $row["id"] . "Read more</a>";

        };

    Close connection

    ?>
    I myself am learning php hope this helped some if not

    http://www.phpfreaks.com/tutorials/5/0.php

    that is what i used as a reference
    Last edited by BoggeRs; 07-06-2005 at 01:26 PM.

Posting Permissions

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