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 .
- Articles are here - Darth
- code.tutsplus.com/articles/β¦ - E_p
1 answer
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