dynamic sql
| From: | Michael K. Dolan Jr. | Date: | Fri, 25 Jan 2002 04:58:35 +0000 |
| Subject: | dynamic sql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16158@lists.php.net to get a copy of this message | ||
Is it possible to do a sort of dynamic sql. For instance, if I have a form with a bunch of
field/data variables and I send them to a php processor, can I just create a loop to have it update
all the fields without having to specify each field.
In scratch code, I guess I'm looking for something like this:
sql = "UPDATE my_table SET $table_field_name = $table_field_value WHERE table_id =
$table_id"
If you see how I'm trying to make the field name a dynamic variable, then you can see what
I'm trying to do. I have no problem with the dynamic field value, it's just the dynamic
field name that I'm not sure how/if I can create it dynamically.
Can anyone help with this? Or can anyone tell me it can't be done?
Thanks
Mike