September 3rd, 2000, 10:02 PM
-
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);
September 3rd, 2000, 10:25 PM
-
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
September 4th, 2000, 09:14 AM
-
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).