maybe the question title is not very descriptive. That's because I really didn't know how to write it. But my problem here is that I have one table named pagemeta
with three columns id
, page_property
and property_value
and this is how it looks like:
-----------------------------------
id | page_property | property_value|
------------------------------------
1 | telephone | 445854541 |
2 | email | c@gmail.com |
3 | icon | img/1.jpg |
So far so good. Now I have a html form which sends a post request to a php page. The $_POST
array keys are named after the fields from the page_property
column, like: telephone and email and icon. The $_POST
array values are set from the input fields in the form. At the end I have a $_POST array with these values:
telephone=>8988989
email=>b@gmail.com
icon=> img/2.jpg
The problem begins here where I try to update the pagemeta
table. I don't know how to write the UPDATE
query where the fields in the property_value
column are updated with their corresponding key from the $_POST
array. It means that the fields in property_value
should be updated related to the field values in the page_property
column. Sorry for asking so unclear and complicated. I really didn't know how to explain. Any edit would be welcome and any answer would be a great help. Thanks
I've search everywhere but didn't find any answer.