title: SQL query error - can't see why?
body: <p>I'm currently reading through this Yii application eBook: <a href="http://www.packtpub.com/agile-web-application-development-yii11-and-php5/book" rel="nofollow">http://www.packtpub.com/agile-web-application-development-yii11-and-php5/book</a> - and I'm having a problem inputting the tutorials DDL / SQL statements into PHPMyAdmin without it throwing up errors.</p>
  
  <p>Would someone be kind enough to shed some light on why the following syntax is invalid? It might be something simple but I can't see it:</p>
  
  <p><strong>SQL statement:</strong></p>
  
  <pre><code>ALTER TABLE tbl_issue
  ADD CONSTRAINT FK_issue_project FOREIGN KEY (`project_id`)
  REFERENCES tbl_project(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
  
  ALTER TABLE tbl_issue
  ADD CONSTRAINT `FK_issue_owner` FOREIGN KEY (`owner_id`)
  REFERENCES tbl_user(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
  
  ALTER TABLE tbl_issue
  ADD CONSTRAINT `FK_issue_requester` FOREIGN KEY (`requester_id`)
  REFERENCES tbl_user(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
  
  ALTER TABLE tbl_project_user_assignment
  ADD CONSTRAINT `FK_project_user` FOREIGN KEY (`project_id`)
  REFERENCES tbl_project(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
  
  ALTER TABLE tbl_project_user_assignment 
  ADD CONSTRAINT `FK_user_project` FOREIGN KEY (`user_id`)
  REFERENCES tbl_user(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
  
  INSERT INTO tbl_user (`email`, `username`, `password`)
    VALUES
  (`test1@notanaddress.com`,`Test_User_One`, MD5(`test1`)),
  (`test2@notanaddress.com`,`Test_User_Two`, MD5(`test2`));
  </code></pre>
  
  <p><strong>Error Message</strong></p>
  
  <blockquote>
  <pre><code>Error
  SQL query:
  
  ALTER TABLE tbl_issue
  ADD CONSTRAINT FK_issue_project FOREIGN KEY (  `project_id` ) 
  REFERENCES tbl_project(  `id` ) ON DELETE CASCADE ON UPDATE RESTRICT ;
  
  
  MySQL said:
  
  #1005 - Can't create table 'trackstar_test.#sql-c78_127' (errno: 121) (&lt;a    
  href="server_engines.php?engine=InnoDB&amp;amp;page=Status&amp;amp;
  token=252c0553975923580ca430b6e98c4243"&gt;Details...&lt;/a&gt;)
  </code></pre>
  </blockquote>
  
  <p><strong>Note:</strong></p>
  
  <ul>
  <li>All the tables in the database are set to innodb as their storage engine.</li>
  <li>I've tried using different foreign key names for each FK, still get the same error.</li>
  </ul>
  
  <p><strong>Update:</strong></p>
  
  <ul>
  <li>After finding no solution to the problem, I deleted by DB, uninstalled Xampp and then redid everything again. Seems to work now. Sorry to not be able to tell future readers exactly what the cause was, but it was most probably to do with my Database config or the information I added to it.</li>
  </ul>