Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
¿Cómo puedo obtener registros de la tabla mysql en cakephp 3.0 con la condición OR?

Quiero obtener registros de la tabla para nombres que comienzan con a, b o c pero con estado = pendiente en cakephp 3.0. Estoy intentando debajo de la consulta. Verifique qué es lo que está mal, ya que también obtiene resultados que comienzan con el nombre 's':

 $this->loadModel('DbArtists'); /*** fetching records alphabetically ***/ $artists_q = $this->DbArtists->find()->where(['album_status' => 'pending'])->orWhere(['name ' => 'A%', 'name ' => 'B%', 'name' => 'C%']); $artist = $artists_q->all(); echo "<pre>";print_r($artist);die;
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Haz lo siguiente: -

 $artists_q = $this->DbArtists->find()->where([ 'album_status' => 'pending', 'OR' => [['name LIKE' => 'A%'],['name LIKE' => 'B%'],['name LIKE' => 'C%']], ]);

O puede verificar una vez esto también: -

 $query = $articles->find()->where(['album_status' => 'pending']) ->orWhere(['name LIKE' => 'A%']) ->orWhere(['name LIKE' => 'B%']) ->orWhere(['name LIKE' => 'C%']);

Referencia:- https://book.cakephp.org/3.0/en/orm/query-builder.html

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!