Forum Moderators: coopster

Message Too Old, No Replies

Why are three of only four rows of data "showing"

MySQL thinks it's funny only showing three of four rows returned

         

PieSocial

3:38 am on May 17, 2005 (gmt 0)

10+ Year Member



Hello I'm having a problem using MySQL with my PHP program. I believe this is something to do with how MySQL says Showing rows 0 - 3 (4 total,... Why is that?

Showing rows 0 - 3 (4 total, Query took 0.0002 sec)
SQL-query:
SELECT i.id, i.name, i.mime, i.category
FROM images AS i
JOIN category_img AS c ON i.category = c.id
WHERE c.user =1
ORDER BY c.`order` DESC
LIMIT 0 , 30

------------------------------

id name mime category
47 'Filetest#*$!' image/png 6
46 'File 4' image/jpeg 6
48 'hottness--667' image/jpeg 11
44 'Why the hell was it named this' image/jpeg 11

------------------------------

Above is the SQL query and the data I get returned which is displayed correctly, however when it's run on my page the last value is always omitted.

For instance if I choose to have the results desplayed in Ascending order then 'File 4' is missing. Also for instance right now 'Why the hell was it named this' is missing from the result.

Thank you for your help all internet friends. :) I don't know what is wrong with my code.

PieSocial

4:48 am on May 17, 2005 (gmt 0)

10+ Year Member



The first thing I would have thought is that it isn't grabbing for the category_img table correctly, but the missing value in this example is actually from one of two categories. Category 6 or 11.

The other value from the same category is displaying so it's always just the last value which isn't. Nothing to do with the other table which is why I didn't include it's values. This problem should be able to get solved with the code that I posted.

Any Ideas? Thanks.

That's weird hey that it will show all four values when I input the sql query into phpmyadmin, but that it says it's only showing rows 0 - 3 with 4 total. Then when I use the query only three rows are returned.

PieSocial

6:26 am on May 17, 2005 (gmt 0)

10+ Year Member



*blushing*

Here's what I did TOTALLY WRONG I AM AN IDIOT I AM SORRY:

<?php
for($i=0;$i<count($cats);$i++)
?>

instead of:

<?php
for($i=0;$i<count($files);$i++)
?>

Still what's the showing 0-3 (4 total... all about? Thanks. I can't figure out what that means and I haven't noticed it before.

jatar_k

7:28 am on May 17, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



0 is the first row

not all things start at 1, a lot use 0 as the first

the first element in an array is $array[0]
the first returned row is $row[0]

>> I AM AN IDIOT

there are no idiots here

PieSocial

8:26 am on May 17, 2005 (gmt 0)

10+ Year Member



oh yea I forgot that.