+ 7
SQL or PHP?
I'm working on a project with quite a lot of stuff in the DB. Is it better to leave complex data manipulation in the DB, or do it in PHP, what's your opinion?
49 Answers
+ 12
sql is better... as it is more easier and commonly used
+ 10
In my opinion SQL is easier but can't do everything PHP does. If you just want to work with a DB for a webpage I would choose SQL.
+ 7
If by PHP you mean merely keeping the data in some text file, it's much better using databases.
+ 7
Data manipulation should be left to SQL because you can leverage DB Server capabilities.
+ 6
SQL is easier choose SQl first...
+ 5
SQL
+ 5
Sql all the way...
+ 4
mariadb
+ 3
I like SQL more!
It's much easier to learn SQL
+ 2
@Norayr - not an option. DB ist a part of third-party software with no API of any kind.
+ 2
Always it depends on last mysql versions support is better for stored procedures, views, joins.
MySQL really sucks on complex querys i like Oracle Or MSSQL community versions.
On current version of PHP two options to manage PDO or mysqli extension, if you are sure of db never migrated to other manager choose MySQLi in other case choose PDO.
+ 2
both))
+ 2
I think its better to do Both. You wouldn't do much in PHP without SQL. You will always need SQL in php back end. Uness you will just be frontend.
+ 2
Obviously you should use sql
+ 2
SELECT from the DB using complex query, use it for output and calculations in PHP, Store result in the dB. MySQL is really good at reading and slow on writing if not doing it properly. It does the job.
+ 2
For my experience is better to use SQL and put scripts into views
+ 2
php and sql
+ 2
I love SQL, it's not to complicated but you can get any level of complication you want.
As long as you know what you do and optimize you are going to be fine. if you are getting problems developing you can use a program like Checkmarx to detect any code vulnerabilities and fix them.
Good luck!
Ben.
+ 2
in my opinión you should work with PHP and SQl but in SQl you create procedures and triggers for it's help you with the security and efficiency in the DB
+ 2
both :) because i think they're better working together.