Re: Update multiple records
| From: | Jochem Maas | Date: | Mon, 10 Jan 2005 17:58:52 +0000 |
| Subject: | Re: Update multiple records | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38088@lists.php.net to get a copy of this message | ||
Norland, Martin wrote:
that will be a lone backtick then :-) now where's the cookiejar ;-)-----Original Message----- From: Stuart Felenstein [mailto:stuart4m@yahoo.com] Sent: Monday, January 10, 2005 10:40 AM Subject: [PHP-DB] Update multiple records Having a problem here with updating multiple records in a table.[snip] Lets see - where to begin...SELECT * FROM[snip] You list nothing indicating any sort of update, so forget that for the time being until things are working. That's your end goal, but it doesn't look to be what you're fighting with now. You have a very complicated (perhaps messy, perhaps not - it might all be required) select, and then you're trying to pull that information out and populate a select.ProfilesINNER JOINProfiles_IndustriesON Profiles.ProfileID = Profiles_Industries.ProfileID) INNER JOIN IndTypes ON Profiles_Industries.IndID = IndTypes.CareerIDs) INNER JOIN SU ON (Profiles.kID = `SU.kID) WHERE Profiles.ProfileID = colnameINNER JOIN SU ON (Profiles.kID = `SU.kID)[snip] This line in particular clearly warrants attention. Cookie to whoever guesses what" the' problem` might 'be.
er Martin, no it does not. explode creates an array. the manual defines it as thus: array explode ( string separator, string string [, int limit]) possibly you got mixed up with implode() (or join() which is an alias of implode())<?php $selected = explode(",",$rsLPInds->Fields('IndID')); while(!$rsInds->EOF){ ?>$rsInds->Fields('CareerIDs')?>"<option value="<?php echo<?php if (in_array($rsInds->Fields('IndID'),$selected)) { echo "selected"; } ?> <?php echo $rsInds->Fields('CareerCategories')?></option>[snip] explode() turns an array into a string, you'll have trouble in_array()ing a string. You may want to start there.
You don't list the <select> bit around your select, I'm assuming it's there - what actual behavior/output are you seeing? View source to be sure - you have to specify a select is a multiselect, otherwise it will just be a dropdown and select the first one you say is selected (or maybe the last, I've not messed with it in some time - actually, it's browser dependant, but I think they all tend to behave the same.) rsLPInds->Fields and rsInds->Fields - this is two objects/tables/etc. - you only mention the one, so it's hard to follow what data's where - to be sure. Try that stuff and get back to us. You definitely want to be using print_r() (possibly in <pre> tags) to see what information is actually stored in the results of your select statement, if there is any question there. - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.