title: Can't delete records, duplicated when creating
body: <p>I have 2 tables in my MySQL DB where column "campaignid" in table "pages" refference (= to) column "id" in the table "campaigns.</p>
  
  <pre><code>ALTER TABLE pages ADD FOREIGN KEY (campaignid) REFERENCES campaigns(id);
  </code></pre>
  
  <p>The data in these columns is called by this public function:</p>
  
  <pre><code>public function get_pages_by_campaign_id($campaignID) {
      $campaignID = $this-&gt;real_escape_string($campaignID);
      return $this-&gt;query("SELECT pid, campaignid FROM pages campaigns WHERE campaignid = 'campaigns.id'");
  }
  </code></pre>
  
  <p>However when I try to delete a "page" using:</p>
  
  <pre><code> public function delete_page($pageID) {
      $this-&gt;query("DELETE FROM pages WHERE id = " . $pageID);
  }
  </code></pre>
  
  <p>Nothing happens. Should I have set something like <code>ON DELETE SET NULL | ON UPDATE CASCADE</code> or something????</p>
  
  <p>At the moment I cannot update, delete or save anything to the DB, which has been the case for 2 days now ... any help would be Greatly Appreciated!</p>