Why won't my select code work?

Discussion in 'MySQL' started by Imozeb, Apr 13, 2010.

  1. #1
    This is my select statement

    "SELECT * FROM `U_Database` LIMIT 0, 10";

    I want it to select all the columns and rows 1 - 10 in my database. It selects all the columns but only 1 row. Why is this?
     
    Imozeb, Apr 13, 2010 IP
  2. NemoPlus

    NemoPlus Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello,

    First remark: you cannot select columns/rows from a database, but you select them from a database table.

    If U_Database represents indeed the name of your table instead of your database (or you might say databaseName.tableName), then it is clear that the query is fully correct. Perhaps:
    - there is something wrong with your code to display the data
    - there is only one row in the table :)

    If you are doing this in your scripting language (php, ...) I recommend to test your query in your mysql client.

    Kind regards
     
    NemoPlus, Apr 14, 2010 IP
  3. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I tested it in mysql client and it outputed the correct data. I guess it is something in my PHP script...

    Thanks.
     
    Imozeb, Apr 14, 2010 IP