One database, different forms

From: Date: Sun, 13 May 2001 20:31:01 +0000
Subject: One database, different forms
Groups: php.general 
Request: Send a blank email to php-general+get-52638@lists.php.net to get a copy of this message
I am writing a PHP application that will operate on a MySQL database. There will be 4 types of forms (like catalog request, info request, etc.) calling the code which writes the data to the database. Since the variable names on the forms will equal the MySQL column names (as they should), I am wondering if there is a way for me to create my SQL statements on the fly so that only data passed is written. Otherwise I'll have to create 8 types of SQL statements...INSERT (if the record, keyed by e-mail address, doesn't exist), and UPDATE (if the record does exist) for all 4 forms. For example, on my "add to mailing list" form, only the e-mail address is collected. I'd like the PHP to recognize that only the 'email' field is passed and create the SQL statement that only writes the e-mail to the database. Any ideas greatly appreciated! Thanks, Rory -- ----------- providing the finest in midget technology

« previous php.general (#52638) next »