php - Marking few items from a list based on a database -


i have list of n items(in multiple categories) like

category       1       2       3 category b       1       2        .... 

stored in mysql database. corresponding particular user, know m (m <=n) of them should marked user (stored in database userid|itemid table.) while displaying them html list.

what efficient way this? i'm using php

we can in o(mn) checking each list item against user history there better way? , can algorithm change if know m << n .

step 1: name variables populating checkboxes intelligently can reference them id of item.

step 2: pull (m) items out of database.

step 3: loop through (m), , each item in (m), mark checkbox 'checked'.

o(m) result.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -