how to mix two arrays elements with custom format

hi all,
I've a crazy idea about having the form elements  to be grabed from the form by looping in the $_post and getting their names and values
then forming the sql statments on the fly to insert , update, delete it. but I have problems

1. with validation and how to do it on the fly  and how to match it with the $_post elements easily without pain
2. in formating the update statement  using the current value and new value as a solution for concurrency
eg. update t1 set  x1= y1, x2=y2 where x1=z1 and x2=z2
can any body help in that
any suggestion is highly recommended

best regards
HG
shang3000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ddrudikCommented:
It's simple enough to loop through the $_POST array, but explain this part of your statement further:
"2. in formating the update statement  using the current value and new value as a solution for concurrency
eg. update t1 set  x1= y1, x2=y2 where x1=z1 and x2=z2"

Provide an example $_POST array and how you want your update statement formatted based on that data.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
waygoodCommented:
email me at  mwwaygoo AT hotmail DOT com  and I'll send you mine. It's a bit too big for here.
0
ddrudikCommented:
waygood, it's over 5MB in size?  That's what the checkbox "Attach File" below this comment window allows for.  

E-mail contact outside of EE in resolution of a question is not allowed by EE.
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

waygoodCommented:
not over 5MB, just not willing to distrubute such a fine piece of work into the public domain
0
ddrudikCommented:
Then, without the file, and lacking the output of the requested $_POST array, show a more involved example of what you want to accomplish and specifically the output of the update statement you would like assembled.
0
shang3000Author Commented:
hi ddrudik,
thanks for reply

>>>It's simple enough to loop through the $_POST array, but explain this part of your statement further:
>>>"2. in formating the update statement  using the current value and new value as a solution for concurrency
>>>eg. update t1 set  x1= y1, x2=y2 where x1=z1 and x2=z2"
>>>Provide an example $_POST array and how you want your update statement formatted based on that data.

here is an example used for insert statment

$sql= "INSERT INTO $table (%s) VALUES (%s)";
$sql= sprintf($query, implode(",", $field), implode(",", $value));

now my question is :
how to form a updete statement like the previous one using similar syntax
so that :
record with id x
$field[$i] and value[$i] and get the the values of that record with their fields names in field2[$i] and value2[$i]

can be formated like that
"update t1 set $field[0]=$value[0] , $field[1]=$value[1] , $field[2]=$value[2]  .......
where $field2[0]=$value2[0] and  $field2[1]=$value2[2] and  $field2[0]=$value2[2] ...."


can you help me in that without making concatination????
best regards
Hg
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.