in reply to mysql database
About the actual algorithm...
If i understand your problem correctly, you want to
print a list of all of the items in @id
and
if this $id[$i] is also in the database (identified by variable $identifier)
print $id with a checked checkbox,
else print $id without an unchecked checkbox.
If this is what you want to do, then...
1. Loop through @id,
1.1 Query database using your $id as a search criteria,
1.2 If there is a match, then
1.2.1 print a checked box with $id
1.3 If there is no match, then
1.3.1 print an unchecked box.
It this is not what you want to do, just forget I mentioned it.
PS: If @id is huge, then another algorithm may be more appropriate, which minimizes all the queries to the database.
My $.02 worth: When I was first learning to program, my mentor insisted that I write my algorithm 1st, and then step through it with 'dummy data' while pretending to be the computer (do what I say, not what I mean). This method works well when you are still at the learning phase of programming.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: mysql database
by bory (Beadle) on Dec 15, 2003 at 09:22 UTC | |
by Sandy (Curate) on Dec 18, 2003 at 16:59 UTC |