PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 13, 2022

[FIXED] Between query in cakephp 3.3

 February 13, 2022     cakephp, cakephp-3.0, mysql, php     No comments   

Issue

THE QUERY IS WORKING

Want to write the query below by using cakephp 3.3

SELECT 

Books.id AS Books__id, Books.title AS Books__title, Books.for_min_age AS Books__for_min_age, Books.for_max_age AS Books__for_max_age, Books.for_min_grade AS Books__for_min_grade, Books.for_max_grade AS Books__for_max_grade FROM books Books WHERE 4 BETWEEN Books.for_min_age AND Books.for_max_age OR 2 BETWEEN Books.for_min_grade AND Books.for_max_grade


Solution

I achieve this by -

 $this->find()->where([$age . ' BETWEEN Books.for_min_age AND Books.for_max_age OR ' . $grade . ' BETWEEN Books.for_min_grade AND Books.for_max_grade']);


Answered By - Mumtaz Ahmad
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing