Thread: News System?

Results 1 to 3 of 3
  1. #1 News System? 
    MattScape
    Guest
    Ok well I have been searching for a long time and have failed to find a news system that let the administrator login and then lets him post a new news article that will display at the top of the news list, pushing the rest down, and the extras onto a new page if there is too many. Pretty much, one that works like RuneScape's News System.
     

  2. #2  
    is serisiuly cul.

    DJ Dan's Avatar
    Join Date
    Apr 2007
    Posts
    1,324
    Thanks given
    6
    Thanks received
    5
    Rep Power
    223
    Easy like eatin' a pie.

    You need to make a MySQL database,
    make a table inside it called "news" (without the speech marks).
    You will need to make 4 rows.

    1) id - int(11) auto imcremit (sorry for spelling) and primary key
    2) title - text
    3) content - text
    4) date - text

    Ok then click Save or something.

    Now you need to pull it from the database into a PHP script.

    Qouted from [Only registered and activated users can see links. ] --
    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("my_db", $con);

    $result = mysql_query("SELECT * FROM person ORDER BY age");

    while($row = mysql_fetch_array($result))
    {
    echo $row['FirstName'];
    echo " " . $row['LastName'];
    echo " " . $row['Age'];
    echo "<br />";
    }
    mysql_close($con);
    ?>
    -- Edit the $con variable to the connection information. (host, username, password)
    -- Change the database name in the function mysql_select_db.
    -- Change the table name in the mysql_query.
    -- Change where it says by ORDER BY age. Replace that with ORDER BY id DESC
    -- Change the $row[]; variables to your row names! (E.G: echo $row['title']

    You can make this script more advanced and advanced.

    By the way: Make sure you put that PHP Script on a PHP Supported server and the file extension of that file to .php

    EDIT: Ooops sorry, I didn't realize you posted this in the VBScript section. My bad. I thought you wanted it done in any language. Sorry, Dan.
     

  3. #3  
    Sub
    Sub is offline
    sυввч

    Sub's Avatar
    Join Date
    Aug 2007
    Age
    21
    Posts
    4,325
    Thanks given
    1,082
    Thanks received
    346
    Discord
    View profile
    Rep Power
    2755
    Quote Originally Posted by DJ Dan View Post
    Easy like eatin' a pie.

    You need to make a MySQL database,
    make a table inside it called "news" (without the speech marks).
    You will need to make 4 rows.

    1) id - int(11) auto imcremit (sorry for spelling) and primary key
    2) title - text
    3) content - text
    4) date - text

    Ok then click Save or something.

    Now you need to pull it from the database into a PHP script.

    Qouted from [Only registered and activated users can see links. ] --


    -- Edit the $con variable to the connection information. (host, username, password)
    -- Change the database name in the function mysql_select_db.
    -- Change the table name in the mysql_query.
    -- Change where it says by ORDER BY age. Replace that with ORDER BY id DESC
    -- Change the $row[]; variables to your row names! (E.G: echo $row['title']

    You can make this script more advanced and advanced.

    By the way: Make sure you put that PHP Script on a PHP Supported server and the file extension of that file to .php

    EDIT: Ooops sorry, I didn't realize you posted this in the VBScript section. My bad. I thought you wanted it done in any language. Sorry, Dan.
    hehe lol i dont get vbscript Lol thanks for the system though ill add it to cutenews =]
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

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