Hi All!
While this is not a huge problem, it is a recurring one so I thought I would
see if someone else has a nice generic way of handling this situation. I
often set up database tables with a PHP4 interface to handle insertions.
It is always set up on a CGI basis, wherein a form blasts variable names and
values to the interface, which does the insert. Often a table consists of a
few hundred variables. Clearly when entering the variables by name into
the statements below, there is room for little errors to creep in, even
though I copy the var names from a table export. For example, in a list
of 500 variable names I might accidentally not copy a variable or miss part
of one inadvertantly. This takes a while to find.
$Entry=MYSQL_QUERY("INSERT INTO seniors(interviewer, surveynum, dat, q1_1,
q1_2, q1_3, q1_4)
VALUES('$interviewer', '$surveynum', '$dat', '$q1_1',
'$q1_2', '$q1_3', '$q1_4')");
Being a klutz, I frequently make assorted little errors and it takes some
time to figure where I have screwed up each and every time I set up one of
these things.
I'm wondering therefore if there is a Better Way than using the exact
variable names. For example, using something like a while statement
including :
while(list($key, $val) = each($HTTP_GET_VARS)) { clever stuff here } Does
anyone have ideas on how to do this better? I don't think that I am being
efficient. . .
Thanks!
-Warren
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php