How to create a foreign key in phpmyadmin

0 votes

In my patient table, I want to add a foreign key for doctorid.

I have all of my tables established, but the main issue is that only the primary key appears when I go to the table > structure > relation view so that I may build a foreign key (and it is already the primary key of certain table that I want to keep - i.e Patient table patient is enabled to be changed but the doctor Id -I have a doctor table also- is not enabled).

I have another table with two composite keys (patientid and medicineid) that allow me to alter both in relation view. Should I change the doctor ID index in the patient table to anything else? Given that patient ID is the primary key for the patient table and doctor is the foreign key, neither can be the primary key.

table

Can someone please help me with this?

Aug 1, 2022 in PHP by Kithuzzz
• 38,000 points
1,959 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
0 answers

How to generate a create table script for an existing table in phpmyadmin?

How can I generate a create table ...READ MORE

Aug 4, 2022 in PHP by Kithuzzz
• 38,000 points
890 views
0 votes
1 answer

How to create a database using PDO in PHP?

Hello @Hitesh, Yes, you can create a database using ...READ MORE

answered Nov 9, 2020 in PHP by Niroj
• 82,840 points
6,433 views
0 votes
0 answers

How to sort an array of associative arrays by value of a given key in PHP?

Given this array: $inventory = array( ...READ MORE

Jul 24, 2022 in PHP by Kithuzzz
• 38,000 points
664 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,808 views
0 votes
2 answers

How can we create a session in PHP?

Hello, niroj. Here is my idea session_start(); $_SESSION['USERNAME'] ...READ MORE

answered Dec 7, 2020 in PHP by Famous
• 140 points
1,200 views
0 votes
1 answer

How to log in to phpMyAdmin with WAMP?

Hello @kartik,  Try-Username: root Password: (No password set). Sometimes it doesn't ...READ MORE

answered Apr 9, 2020 in PHP by Niroj
• 82,840 points
7,073 views
0 votes
0 answers

Fatal error : execution time of 30 seconds exceeded in phpMyAdmin

My MySQL table has 6.5 million records ...READ MORE

Jul 26, 2022 in PHP by Kithuzzz
• 38,000 points
1,719 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,277 views
0 votes
2 answers
0 votes
2 answers

How to send data to my database from html and css Contact Us Form?

Hello @Sign, It is simple to create contact ...READ MORE

answered Aug 4, 2020 in Database by Niroj
• 82,840 points
36,030 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP