Update multiple records
| From: | Stuart Felenstein | Date: | Mon, 10 Jan 2005 16:39:42 +0000 |
| Subject: | Update multiple records | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38086@lists.php.net to get a copy of this message | ||
Having a problem here with updating multiple records
in a table.
First the table is like such:
+-----------------+--------------+
| RecordID [int] | IndID [int] |
+-----------------+--------------+
There is no auto inc column. User has a record number
and then can have multiple rows in table with the same
record number.
i.e:
+-----------------+--------------+
| RecordID [int] | IndID [int] |
+-----------------+--------------+
| 101 | 5 |
+-----------------+--------------+
| 101 | 10 |
+-----------------+--------------+
| 101 | 22 |
+-----------------+--------------+
I've setup the sql result set as such:
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
I have a list menu (multi select) using the IndTypes
table and have named the element IndID[]
I have the array variable to grab the IndID values
from the record set.
inds = implode(",",$_POST['IndID']);
And I am attempting to highlight the IndID that exist
in the users records in the multi select:
<?php $selected =
explode(",",$rsLPInds->Fields('IndID'));
while(!$rsInds->EOF){
?>
<option value="<?php echo
$rsInds->Fields('CareerIDs')?>"
<?php if
(in_array($rsInds->Fields('IndID'),$selected)) { echo
"selected"; } ?> >
<?php echo
$rsInds->Fields('CareerCategories')?></option>
<?php
I'm sure this is all most likely confusing. :) Typical
post from me ...sorry. None of this is working
though.
Perhaps updating multiple records is more difficult
then I first imagined.
Can anyone lend some advice , assistance ?
Thank you,
Stuart