I
I
idccc2014-06-29 14:19:30
PHP
idccc, 2014-06-29 14:19:30

How to create a new table from an existing one in PHP?

Good afternoon.
There is a tabular selection from the database of the following form:

IDpost_idmeta_keymeta_value
one645meta_key_1"habrakadabra"
2508meta_key_1"opa"
3645meta_key_2"priznak"
4508meta_key_2"dasdasdasd"

Suppose we have already parsed it using foreach. It is required to create a new table using a php query in such a way that for all rows whose post_ids match, all their meta_values ​​for the corresponding meta_keys appear in one row. I.e:
IDpost_idmeta_value_of_meta_key_1meta_value_of_meta_key_2
one645"habrakadabra""priznak"
2508 "opa""dasdasdasd"

This is real :) ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2014-06-29
@idccc

Please prove that you know what you are doing by breaking the normal form of the database (normal form is a technical term). Those. a clear argument as to why it should be done that way.
Then I will post the solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question