0

HI Have a field in database which has multiple of the same number in, I have got a query of which works with the field with 1 in but then want it to then go to ++ so if I limit 9 results they will show with this query for all echoed out fields and only one result for naughtyfield =1, naughtyfield=2,naughtyfield3 etc etc up to 9

SELECT * FROM _TABLE WHERE naughtyfield=1 GROUP BY naughtyfield, field2 ORDER BY naughtyfield, field2 ASC LIMIT 9

HOpe some one can help and hope I have explained it OK , Thanks

Edited by pritaeas: Moved.

2
Contributors
6
Replies
20
Views
4 Years
Discussion Span
Last Post by pritaeas
0

`

$result = $dba->query()->fetchAll(PDO::FETCH_ASSOC);

$dba = null;

$break = 3;

$lineend = $break;


        echo '' . $row['field'] . ' ' . $row['naughtyfield'] . ' ' . $row['field'] . '';



        echo '</ul>
                        </div>
                </div>
                <div class="threeColFooter">
                </div>';

        echo '</div>';

        if(($k + 1) == $break)
        {
                echo '<div class="clear"></div>';

                $break = $break + $lineend;
   $lineend;
        }
}
?>

`

0

show some data, and your expected output

I didn't mean code. I meant the data that is in your table, and how you want it to look after retrieving it.

0

data eg

Field Field2 naughtyfield
blar 7 1
blar 5 2
blar 4 3
blar 9 4
blar 6 5
blar 5 6
blar 1 1
blar 2 2
blar 5 3
blar 4 4
blar 6 5
blar 12 6

result

1-1
2-1
3-4
4-4
5-6
6-5

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.