There is a system for recording passport data and patient history. How to add passport data to mysql everyone knows, in principle, and you can also add a case history. But the question arises Passport data are recorded once but the history of illness and repeated admission can be repeated several times. Thus, each patient has several tricks on the card. And all this information about the techniques will need to be displayed on the card of one patient. How to be in this case. How can you implement this scheme in php mysql. Maybe someone has some ideas or wherever there are articles.

Closed due to the fact that the issue is too general for participants Dmitriy Simushev , user207618, Streletz , Grundy , VAndrJ 15 May '17 at 7:53 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See β€œHow to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

1 answer 1

The question is simple, but I feel the author of the question should write down the principle of work.

Suppose you have 2 tables, "cards" and "techniques".

"cards"

+++++++++++++++++++++++++++++++ | Π½ΠΎΠΌΠ΅Ρ€ ΠΊΠ°Ρ€Ρ‚Ρ‹ | ЀИО + паспорт | +++++++++++++++++++++++++++++++ | 123 | lampa 123456 | +++++++++++++++++++++++++++++++ 

and "receptions"

 +++++++++++++++++++++++++++++++++++++++++ | Π½ΠΎΠΌΠ΅Ρ€ ΠΏΡ€ΠΈΡ‘ΠΌΠ° | Π½ΠΎΠΌΠ΅Ρ€ ΠΊΠ°Ρ€Ρ‚Ρ‹ | описаниС | +++++++++++++++++++++++++++++++++++++++++ | 81 | 123 | ... | +++++++++++++++++++++++++++++++++++++++++ 

As you can see, the tables are interconnected, or rather the table "techniques" is attached to the table "cards" using the column "card number", this method is called One-to-Many , as indicated by @Darth

And as an example of code:

 $priem = $pdo->query("SELECT * FROM ΠΏΡ€ΠΈΡ‘ΠΌΡ‹ WHERE `Π½ΠΎΠΌΠ΅Ρ€ ΠΏΡ€ΠΈΡ‘ΠΌΠ°`=$priem_id")->fetch(); $karto4ka = $pdo->query("SELECT * FROM ΠΊΠ°Ρ€Ρ‚ΠΎΡ‡ΠΊΠΈ WHERE `Π½ΠΎΠΌΠ΅Ρ€ ΠΊΠ°Ρ€Ρ‚Ρ‹` = $priem->Π½ΠΎΠΌΠ΅Ρ€_ΠΊΠ°Ρ€Ρ‚Ρ‹")->fetch(); 
  • Thank you, lampa, just what you need! - Alex Stassov