/    Sign up×
Community /Pin to ProfileBookmark

Getting Specific Data from SQL results table

I’ve got a bunch of data 50 rows to be specific.

I want them in 5 rows of 10 in specific places.

So one column will have a unique ID or value. that’ll go in a specific place.

If there a way to do a subquery of my already queried data to avoid doing 50 unique quires.

So… query. Get my 50 results

then echo where this value is equal to something specific which could be any one of the 50 rows.

Doing a loop could work. But I’ll have to loop all 50 as I place all 50 in specific locations.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 23.2021 — I'm not shure if I understand you correctly: You need all 50 rows but you intend to make 5 groups and place them in different locations on your page? Then the grouping feature of PDO might help you:

https://stackoverflow.com/questions/5361716/is-there-a-way-to-fetch-associative-array-grouped-by-the-values-of-a-specified-c

However, this would require that there is a suitable grouping criterium in your result.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...