I'm having a REALLY hard time with something that's probably easy to do (for
someone :-)...

Normally, to perform an update on a table with data from a submitted form, I
would use something like:

  $sql = "UPDATE $table SET pet='$pet', name='$name' WHERE id=$id";
  $result = mysql_query($sql);

And it would work.  Of course, if I wanted to update a different table (with
different columns/fields), I would need to only change the SET part of the
SQL (since the value for $table is dynamically generated). For example,

  $sql = "UPDATE $table SET car='$car', year='$year' WHERE id=$id";
  $result = mysql_query($sql);

But here's what I want to do now:  I want to use the same two lines of code
for any possible form data that might be submitted--in other words, I don't
want to have to create unique $sql/$result lines for each and every table in
my database.  I want this .php code to accept whatever number and type of
form elements/data submitted, and make the appropropriate SET values.
Anyone know how I can do that?  I actually have tried several things to pass
the form data strcuture (number and names of columns) over to this php code,
but haven't been able to get anything working.  Can anyone help??  Much
thanks if you can..


Rene Fournier

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to