Search Postgresql Archives

Re: Wich the best way to control the logic of a web application?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 19, 2009 at 05:46:17PM +0100, Andre Lopes wrote:
> What do you think aboout this? Should I mix logic in Database and PHP or
> should I control the logic only in the PHP?

As always, it depends!  I tend to put things where ever it's most
convenient, however data integrity and other invariants within your
code will dictate some levels above which you can't place code.  In
your email address example before, this can easily be done in PHP (or
even JavaScript, client side) as the database doesn't care whether it's
getting a valid email address or not--it's just a character string
to the database.  To go to the other extreme, referential integrity
is (almost?) always best done inside the database as it has all the
information needed to do the right thing.

-- 
  Sam  http://samason.me.uk/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux