Re: RI with PHP and mysql

From: Date: Wed, 15 Nov 2000 18:34:44 +0000
Subject: Re: RI with PHP and mysql
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3874@lists.php.net to get a copy of this message
Larry Hotchkiss wrote: > Im pretty new at this so I am looking for some suggestions on implementing > RI(referential integrity) on web based form where certain fields MUST exist > in certain databases. Preferably having choices loaded into a dropdown on > the form. Can anyone point me to a decent tutorial on something of this > nature? Larry, Don't want to write your code for you :) - but here's a breakdown. You'll run all this out of a single php-script to generate the form page... 1) Run a mysql select statement on your database to retrieve the records/fields you want for the dropdown (presumably with unique id and textual name) into an associative array (maybe an array of hashes). Or you could simply use the fetchrow calls on a resultset to get at the data. 2) When you get to the <select> tag (dropdown) in HTML portion of your script, write some code to iterate across that resultset (using fetchrow), setting the <option> values and displayed text from your data. Pretty much a standard approach :) -- Andy Hoffman Web Developer Bristol-Myers Squibb email: andy.hoffman@bms.com

« previous php.windows (#3874) next »