Advertisement

10.06.2008 at 10:34AM PDT, ID: 23791204
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

PHP/MySQL delete problem

Asked by Simon336697 in PHP Scripting Language, MySQL Server

Hi everyone.
Guys i have 2 tables in a mysql database that im using with php.
They are called
projects_pro      and
currenttasks_ctk

In projects_pro, i simply have 2 fields, namely:
id_pro       (auto_increment)   and
name_pro      ( a unique name for the project)

In currenttasks_ctk, i have the following fields...
id_ctk      (auto_increment)
name_ctk
fk_id_pro_ctk   ( foreign key to the id_pro field of the projects_pro table)
description_ctk

So basically, in order to add a new task to the currenttasks_ctk table, the new task MUST have a reference to the id_pro field for the column fk_id_pro_ctk, otherwise the new record is rejected.

The problem im having is this...

I cannot delete a project record from the projects_pro table IF there exists any records with this id value (eg. for fk_id_pro_ctk) in the currenttasks_ctk table.

So im wondering how i can remove a record from the projects_pro table, and 'cascade' or delete all corresponding entries that have this id_pro value for fk_id_pro_ctk ?
Basically, if i remove a project, and it has attached to it, tasks in the currenttasks_ctk table, I need those tasks deleted from the currenttasks_ctk table upon choosing to remove that project.

At the moment, i cant remove project records, and im using the following for example.
delete from projects_pro where id_pro = '10';

The error i get is:

Cannot delete or update a parent row: a foreign key constraint fails (`tasksdb/currenttasks_ctk`, CONSTRAINT `currenttasks_ctk_ibfk_1` FOREIGN KEY (`fk_id_pro_ctk`) REFERENCES `projects_pro` (`id_pro`))


Any help greatly appreciated.


Start Free Trial
[+][-]10.06.2008 at 11:03AM PDT, ID: 22652664

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, MySQL Server
Sign Up Now!
Solution Provided By: arnold
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.06.2008 at 11:06AM PDT, ID: 22652697

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.06.2008 at 12:25PM PDT, ID: 22653466

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 03:43PM PDT, ID: 22655076

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 03:45PM PDT, ID: 22655091

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 03:53PM PDT, ID: 22655147

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 04:01PM PDT, ID: 22655226

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 06:44PM PDT, ID: 22656041

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.06.2008 at 07:12PM PDT, ID: 22656157

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628