> -----Original Message-----
> From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
> 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.  

Lets see - where to begin...

> SELECT * FROM `Profiles`   
> INNER JOIN `Profiles_Industries` ON 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 = colname 

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.

> INNER JOIN SU ON (Profiles.kID = `SU.kID)

This line in particular clearly warrants attention.  Cookie to whoever
guesses what" the' problem` might 'be.

> <?php $selected =
> explode(",",$rsLPInds->Fields('IndID')); 
>   while(!$rsInds->EOF){
> ?>
>               <option value="<?php echo
>                         <?php if
> (in_array($rsInds->Fields('IndID'),$selected)) { echo "selected"; } ?>
>                         <?php echo
> $rsInds->Fields('CareerCategories')?></option>

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

- 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.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to