On Fri, Jul 12, 2002 at 10:57:08AM +0200, Paul Dionne wrote: > > Problem: How do I display all the tblCountriesOfOperation for one > tblContacts record SO THAT MULTIPLE COUNTRIES CAN BE ADDED OR DELETED FOR > THAT RECORD?
Use an option list with multiple selections. My SQL Solution does this very simply. In essence, when doing the record lookup to display, run a query against the countryies of operation table with the company id. Loop through the recordset placing each row into an array, say $CountriesIn Run a second query against the table of all countries and use that to make an option list. As you're looping through the option list creation process, check the current() element of the $CountriesIn array. If it matches, print out a "selected" and do a next(). (Simlarly, and probably better, you could skip the current()/next() by doing an in_array().) Now, when saving the changes after editing, loop through the array returned by the countries of operation option list doing an INSERT INTO query to the countries of operation table. (The table should be primary keyed CompanyID and CountryID). If the current query would create duplicate data, the database wouldn't insert the record, no problem. Make sense? --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php