Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, you have a foreign key on <code>tbl_products</code> on the column <code>categoryname</code>. This references the column <code>sub_category_id</code> in <code>tbl_sub_categories</code>.</p> <p>This stated relationship implies that you <em>must</em> have the value you're inserting for <code>categoryname</code> (<code>'9'</code>) in the column <code>sub_category_id</code> of the <code>tbl_sub_categories</code>. It obviously does not exist. Should that <code>9</code> really be a string?</p> <p>Without a lot more information it's technically impossible to help you but here goes:</p> <p>There are two possibilities:</p> <h3>Hypothesis 1</h3> <p>You have the column <code>categoryname</code> in <code>tbl_sub_categories</code> and the name you're inserting is directly related to the <code>sub_category_id</code> you're also inserting (<code>51</code>).</p> <p>Solution 1<br> Remove the column <code>categoryname</code> from <code>tbl_products</code>. There's no need for it to be there in a properly normalised database. Change the foreign key to be a constraint on the column <code>sub_category_id</code> as this is what you seem to be looking up.</p> <p>Solution 2<br> Change the foreign key to be on both <code>categoryname</code> <em>and</em> <code>sub_category_id</code>. This is to stop you from inserting values that don't match the referencing columns.</p> <h3>Hypothesis 2</h3> <p>You have a separate table called something like <code>tbl_categories</code>. In this case, you need to reference this table not <code>tbl_sub_categories</code> in your foreign key.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload