building mysql add/delete/update function/class - comparing array contents
| From: | Nick | Date: | Thu, 20 Jul 2000 11:47:26 +0000 |
| Subject: | building mysql add/delete/update function/class - comparing array contents | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7401@lists.php.net to get a copy of this message | ||
hi,
I'm trying to build a function / class to dynamically enter info from a form into a database,
independent of the form or the database used or of the action (insert, update etc.,..).
Basically, i've got a form with some elements in it, such as:
name
phone
address
ID (auto_increment not null primary key)
timestamp
etc....
The field names in my database are the same as in my form. (name, phone etc...).
As such I though that if I entered the info from the form into an array and compared the keys to the
'name' key in the array returned by mysql_fetch_fields, I could enter the info from the
form in the corresponding field in the db and insert 'null' to the rest. (I actually need
to send NULL in the query, so that auto_increment or timestamp fields automatically set.)
Any ideas ?
Cheers,
nick