Jump to content

Recommended Posts

Posted

Only option I know is plain SQL:

<?php
// populate test value
$pages->get(1)->meta('foo', 'foo');

// find pages
$result = $database->query("SELECT source_id FROM pages_meta WHERE name = 'foo' and data = '\"foo\"'");
$ids = implode("|", $result->fetchAll(\PDO::FETCH_COLUMN, 0));
db($pages->find("id=$ids"));

If you use this with user input be sure to properly sanitize the data and maybe use prepared statements!

  • Like 2
Posted

A couple of potential things - I think getByIDs would be more performant. And also, if you have JSON in the meta, then using JSON_VALUE might be helpful.

image.thumb.png.584f2d9e3aac94dd02673398d81724dc.png

 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...