mysql php question

Discussion in 'PHP' started by izlik, Sep 13, 2009.

  1. #1
    Why wont this one work? :(

    //Edit $result to be your query
    $querry = "SELECT * FROM flash DESC LIMIT 10";
    $result = mysql_query($querry);
    OR die(mysql_error());
    echo "$result";
    ?>

    And while we are on the subject, in the table "flash" i have 3 rows called "name" "size" and "date", how have i display these at diffrent places on a page? let's say like this
    the name is "name"
    the size is "size"
    the date added is "date"
     
    izlik, Sep 13, 2009 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    You need to remove "DESC".

    When you use DESC, you need to specify an ORDER BY field (you call it row) name. For example:

    $querry = "SELECT * FROM flash ORDER BY date DESC LIMIT 10";

    Edit: as premiumscripts said, you also need to change the query statement into:

    $result = mysql_fetch_assoc(mysql_query($querry));
     
    Last edited: Sep 13, 2009
    ThePHPMaster, Sep 13, 2009 IP
  3. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #3
    premiumscripts, Sep 13, 2009 IP