Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The best argument, I think, is that keeping those values in the database means that the values on the page are always in sync with what <em>should</em> be in the database, or what values are allowed to be selected for insertion into the database.</p> <p>Say you have a list of colors you can select. On the HTML page, you allow the user to select 'red', 'green', 'blue', and 'yellow'. The database reflects this.</p> <p>Several weeks later, you have added the functionality for purple, as well. So you allow the user to select 'purple' on the HTML page, but forget about the database. Some user selects 'purple' and an attempt is made to insert their selection into the database, but you get a foreign key constraint error because 'purple' is not a valid value currently in the database!</p> <p>Several weeks later, functionality for 'yellow' has been removed. This time you remember to remove yellow from the database, but forget about the HTML page. So a user selects 'yellow' and an attempt is made to insert their selection into the database, but you get the same foreign key constraint error!</p> <p>Another week later, you add functionality for 'pink'. This time, you remember to add it to the database, but forget about the HTML page. Now, users are missing out on the cool 'pink' functionality that the database allows because the UI was not updated!</p> <p>Simply retrieving possible values from the database means that only the database needs to be updated in cases like this.</p>
 

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