SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I need Help in simple mysql query and PHP

    Hi Boys,

    I'm new here and new to mysql/php

    I created a mysql table called faq with 2 field
    id and info is the field name

    and i want to call the last 4 entry on info field and list them from that table

    and list the info field like

    purple,pink,yellow,orange,grey

    thank you for helping a girl out

  2. #2
    SitePoint Addict Kokos's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The last four entries of the list? Okay, use this code:
    PHP Code:
    <?php
    //First connect to the database! I'm not writing that :P
    $query "SELECT * FROM `faq` ORDER BY `id` DESC LIMIT 0,4";
    $result mysql_query($query);
    while(
    $row mysql_fetch_array($result)){
           echo 
    $row['info']."<br>";
    }
    ?>
    That should work

    Taking over the web one pixel at a time.
    Currently working @ CodeCreators

  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you so much


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
  •