Newsgroups: alt.php, comp.lang.php
Followup-To: comp.lang.php
From: Reha Sterbin <rster...@force.stwing.upenn.edu>
Date: 18 Jul 2002 22:22:08 GMT
Local: Thurs, Jul 18 2002 6:22 pm
Subject: Re: Populating/Checking Checkbox Values Based on Lookup
In article <JhnZ8.569709$cQ3.52707@sccrnsc01>, Jeff Donnici wrote: You might want to think of the MySQL result resource as directions to the next > Ok, so assuming I run both queries, I've now got two result-sets. I iterate > through the ALL result set and create a checkbox for each color. But, at > each stop, I'd like to search the MAPPED result set to see if the ID value > appears in it (in the COLOR_ID column)... If so, add the word 'CHECKED' to > the HTML to pre-check the box. > This is the part I can't seem to find a simple function for. I know I could row of your results, rather than as an array[1]. Of course, if you want an array, it's pretty easy to make one (see below). If I were in your shoes, I'd go get the user's color_ids first and put them while ($row = mysql_fetch_assoc($result)){ } Then, when you go circling through your ALL colors results, you can use in_array() on $users_colors to make your check marks as you go. Hope this helps. -Reha [1] - What the result resource is, precisely, is not really something I know You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||