Rajat Garg
Rajat Garg

Reputation: 542

Sql query not running

When I run the following query on phpmyadmin then it gives me following error

INSERT INTO `infrastructure_support_info`(`s_no`, `student_no`, `books_availability`, `basic_requirements`, `technological_support`, `study_material`, `resource_availability`, `cleaniliness_of_class`)
VALUES ('', '', '$availabilityOfBooks', '$basicRequirements', '$technologicalSupport', '$photocopyOfStudyMaterial', '$availabilityOfOtherResources', '$cleanlinessOfClass')

#1452 - Cannot add or update a child row: a foreign key constraint fails (feedback_system_db.infrastructure_support_info, CONSTRAINT user_std_no FOREIGN KEY (student_no) REFERENCES user_master (student_no))

Upvotes: 0

Views: 24

Answers (1)

juergen d
juergen d

Reputation: 204756

Your table has a reference to another one. If you want to leave that link empty then use null instead of a blank string ''.

Upvotes: 2

Related Questions