Article Management PHP help

Discussion in 'PHP' started by powerlifer, Nov 6, 2009.

  1. #1
    Hello, i run this site here http://www.juicingforum.co.uk

    as you can see its just raw coded xhtml/css, it doesnt run on any content management software etc.

    Basically what i want to know if possible is, is their anyway where the blue box is near the bottom i could pull the latest article and it would show their a little pic, a heading and the first sentance of the article with a link below.

    And have an article page with links of teh articles by date or something.

    Any tutorials would be good i cant code any back end stuff like php or mysql.

    Cheers
     
    powerlifer, Nov 6, 2009 IP
  2. Dennis M.

    Dennis M. Active Member

    Messages:
    119
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Sure could, but from where are you pulling this information? The form or your articles? Also, your articles.php link is broken. You will, however, need your database structure to pull the information (if they're being stored in a DB).

    My hunch is that your database structure does (or should) look something similar to this:

    DB NAME
    - DB TABLE
    * ID
    * Title
    * Content
    * Date
    * Image

    Now, I'm not sure if there is an image field or not, but it will eventually have to be specified.

    Now, you can arrange it how you wish, but you will need to retrieve this information. Here is how you can do that with PHP provided that you have the proper information of structure (so the actual code may differ):

    <?php
    mysql_connect("localhost","DBUSER","DBPASS");
    mysql_select_db("DB_NAME");
    
    $q = mysql_query("SELECT * FROM TABLE_NAME ORDER BY Date LIMIT 1;");
    $r = mysql_fetch_array($q);
    
    print $q['Image']."<br />".$q['Title']."<br />By<br />".$q['Poster'];
    
    mysql_close();
    ?>
    
    PHP:
    The array's ($q['Image'], etc.) just take the field name because we defined them as mysql_fetch_array(); (you could also try mysql_fetch_assoc(); which may also be effective here)

    Regards,
    Dennis M.
     
    Dennis M., Nov 8, 2009 IP
  3. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #3
    way over my head man as i dont even know how to setup a database but thanks for the help anyway:).
     
    powerlifer, Nov 8, 2009 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I thought you wanted this doing for the agreed price in PM :confused:
     
    JAY6390, Nov 8, 2009 IP