Category: Models & ORM

In CakePHP 3, find 10 random blog posts from mysql fast

based on this article: MySQL select 10 random rows from 600K rows fastI am thinking about finding random blog posts in CakePHP. How to use RAND()in query builders?In addition, can you speed

#sql
2 Answers

Category: Models & ORM

In CakePHP 3, Inner join and count records

I want to count female employees per department in CRM, how to build custom query in CakePHP?SELECT     EMP.DeptNo, DEP.DeptName, count(*) AS records FROM    &n

#sql
1 Answers

Category: Models & ORM

In CakePHP 3, identify and remove duplicate records of customers

This is my customers table (example)idnamephonesexstage1John123-456789m02Mary459-234321f33Liza123-123414f14John123-456-789m35Kate999-000999f0...I want to identify and remove duplicate records of custo

#sql
1 Answers

Category: Models & ORM

Update all records using updateAll() and SQL IN clause

I am using Cakephp 3 latest version and I want to update a gender column for multiple rows. I have studied the ORM documentation and I have no idea how to NOT use foreach loop to update multiple rows

SOLVED #sql #updateall
2 Answers
achao
achao

9

Category: Validation

Cakephp 2 how to escape special characters to prevent SQL injection?

Hi, I'd like to know in Cakephp 2 how to escape special characters to prevent SQL injection?For example://input $this->request->data['Model']['name']; // name = 'John "Doe"'I want name fi

SOLVED #sql #injection
3 Answers
Harper
Harper

5

Category: Debugging

How to check latest SQL logs in the controller?

Hi,Is there a way to see latest SQL logs in CakePHP's controllers? I'd like to do this checking in my controller before rendering a view. Like: <?php echo $this->element('sql_dump'); ?

#cakephp #sql
1 Answers