#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    Hello,
    I think I have a bit of a problem on my hands.

    Earlier tonight I thought I put the finishing touches on a
    motorcycle database that I'd been working on for a few weeks. It was
    my first Php/Mysql project and I was glad to get it working.

    Well, as I was about to turn in I noticed an oddity. When querying
    a table with 909 records, only 900 records are being searched. The
    last 9 records are ignored. However, those final 9 records are
    present and accounted for - I can do a query for a specific match at
    the end of the table (#907, for instance) and it displays just fine.

    I read in the MySQL documentation that it could handle over
    50,000,000 records in a database. Surely it should be able to handle
    a puny 1000 record table, right?

    I'm really not sure if this a PHP problem or something else. I
    hope someone here can shed some light.

    Thanks once more,
    Michael


    // this one pulled up the husky CR listing at the end of the table
    $result = mysql_query("SELECT * FROM spec WHERE brand='Husqvarna'
    GROUP BY modelletters ",$db);

    // this one pulled up everything except the husky CR listing (it
    finds the first 900 records and ignores the rest)
    $result = mysql_query("SELECT * FROM spec GROUP BY
    modelletters ",$db);

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    Solution:

    $result = mysql_query("SELECT DISTINCT brand, modelletters FROM spec ORDER BY brand",$db);

    The DISTINCT keyword did the trick. All 909 records are now queried as they should be.

    - Mike
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Bucharest, Romania
    Posts
    18
    Rep Power
    0
    Maybe when you inserted the value of "brand" column in the last 9 records you entered the word "Husqvarna" with spaces before or after and;in this case, though you don't see anything wrong, the criteria from your query are not matched. To avoid this kind of problem apply the php function "trim" to the value you want to insert into a database. (this function elimins from a string the spaces from the beginning and the end).

Similar Threads

  1. Select one resultrow from query result?
    By driz in forum PHP Development
    Replies: 1
    Last Post: February 10th, 2004, 10:59 AM
  2. select last months records
    By clearbar in forum MySQL Help
    Replies: 4
    Last Post: February 4th, 2004, 04:29 PM
  3. Counting records returned from a query
    By adamfogerty in forum Database Management
    Replies: 3
    Last Post: January 27th, 2004, 12:58 PM
  4. Replies: 1
    Last Post: January 13th, 2004, 06:14 PM
  5. Use textarea to run SELECT query commands
    By jpell7 in forum PHP Development
    Replies: 3
    Last Post: January 11th, 2004, 08:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo