Questions tagged [query]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
13 votes
2 answers
353 views

Custom plugins vs query tags: advantages and implementation

An answer to another question touched on the use of writing custom plugins as a more robust alternative to writing a SQL query in a template via the {exp:query} tag. What are the advantages/pitfalls ...
Tom Davies's user avatar
  • 4,398
11 votes
5 answers
2k views

Query optimization and database indexes

I noticed that there a handful of queries that ExpressionEngine runs that don't use any database indexes. An example is the query SELECT DISTINCT ee.* FROM exp_extensions ee WHERE enabled = 'y' ORDER ...
Bryan's user avatar
  • 418
7 votes
2 answers
1k views

How can I use the current logged in member ID in a custom query using the query module?

I have a query that I need to do that involves using the logged in member ID to limit the results. The following does not work, because the {member_id} variable is not parsed early enough. {exp:...
Ben Parizek's user avatar
5 votes
2 answers
518 views

ExpressionEngine 1 Query Module and Ordering SQL UNION

I'm receiving a MYSQL Error on this code in ExpressionEngine 1.6.4 (very old version) {exp:query limit="10" paginate="bottom" sql="SELECT 'gallery' AS `content_type`, `cat_id` AS `entry_id`, `...
Angus's user avatar
  • 153
4 votes
2 answers
190 views

issue with fixed_order and embed query

I’m having some issues with the fixed_order parameter. I’m running a query to order by a matrix col {embed="_includes/_ajax_results" entry_ids="{exp:query sql="SELECT entry_id FROM ...
Jamie Taylor's user avatar
4 votes
1 answer
511 views

Use Query to change status of an entry

THE SHORT: I am looking for the sql query I need to run in order to change the status of an entry. Any help would be appreciated. THE LONG: I have two sperate channels and they are NOT linked via a ...
Mike McBrien's user avatar
4 votes
1 answer
852 views

Low Search Category Query on Results Page

I can not seem to find anything regarding listing what categories were selected in the search query on the results page for Low Search. Here's an example of my code on the search page: ...
Cogweb's user avatar
  • 83
3 votes
1 answer
9k views

Get specific value without having to loop with db class

So I am trying to get a specific setting out of the database. And it seems that most of the CodeIgniter DB actions don't work in ExpressionEngine( http://ellislab.com/codeigniter/user-guide/database/...
gregwhitworth's user avatar
3 votes
1 answer
269 views

QUERY join for members that have entries

I'm trying to learn how to do mysql joins. Twitter has helped already get me started. I'm trying to find the number of members that have entries attached to them... Then the number of members that ...
Jake Chapman's user avatar
2 votes
1 answer
610 views

SQL Query to get entries with their categories

I have the following query that is grabbing entries, but I would also like a 'categories' column that will show a pipe seperated list of the categories assigned to each entry. I have tried using ...
doubleplusgood's user avatar
2 votes
2 answers
2k views

Writing update queries more efficiently in EE

I've got two queries that I'm running separately in a template, one after the other, like this: <?php $sql = "UPDATE exp_channel_titles SET status = 'Registered' WHERE channel_id = '12' AND ...
Stephen's user avatar
  • 1,349
2 votes
3 answers
1k views

Passing ID’s from a query to Channel Entries

I'm using quite a complex query using exp:query to generate the member ID's of members who have certain data in a custom field. I'm struggling on how to pass the generated ID's onto a channel entries ...
Jon Wright's user avatar
2 votes
1 answer
154 views

Wrapping a query in a logic statement

I didn't think this would give me any trouble, but it is. I just want to run a query depending on the URL segments. I have this now: {if segment_3 != ''} {exp:query sql="SELECT a....
W3bGuy's user avatar
  • 1,610
2 votes
1 answer
94 views

Adding status to a query not working

Ive been using a query to pull in the amount of posts from a given category no problem. But i now want to pull in from a given status but no matter what i try its just not working quite right. This ...
Etheya's user avatar
  • 51
2 votes
1 answer
319 views

Quick way to get user's signature in PHP

I'm just wondering if there is a quick way to get a user's signature using something like the session class? For example to grab the active user's email from the session class you can simply call $...
Conor Higgins's user avatar
2 votes
2 answers
319 views

How can I use exp:query in entries?

I'm looking for a way to use exp:query in entries. So far I haven't been able to find this. I know it's not recommended but for what I'm trying to build it's most feasible to do so. That way I'll be ...
Danny's user avatar
  • 23
2 votes
3 answers
3k views

Get all entries where expiration date is within last 12 months

I know this is more of a SQL question, but I'm having trouble getting EE to cooperate. I have entries that expire, and want to show only entries which have expired in the last 12 months. I tried: ...
4midori's user avatar
  • 382
2 votes
1 answer
395 views

Pagination issue with Query and Conditional Statement

I have a script that uses query to determine if a particular entry is open or closed. based on that entry, it then displays a list of blog entry excerpts. if that particular entry id has a status of ...
prosborne's user avatar
  • 107
2 votes
1 answer
98 views

Show a combined Solspace User and native Member entry count?

I have an existing DB with entries that have been assigned to authors via the native Members module as well as Solspace's User module. Unfortunately, the User module doesn't take into account entries ...
Tim's user avatar
  • 636
2 votes
1 answer
118 views

Query a NON EE table in database?

I have a HTML table where a user can subscribe.I send an ajax call when the user clicks the subscribe button and store it in a non ee table.Next time when the user comes on the same page,I want to ...
user avatar
2 votes
1 answer
173 views

Passing entry_id to json to get Playa children

I need to be able to do pass the entry_id of the page being viewed into a json file to build a query. I currently have a page setup that has a Playa field. I need to have a JSON file that will get ...
doubleplusgood's user avatar
2 votes
2 answers
296 views

expression engine super search module : group by issue

I am using supersearch module, here is link for doc of its http://www.solspace.com/docs/super_search. Actually I am facing a problem that is to get records group by. Using this module i dont know how ...
jt.'s user avatar
  • 25
2 votes
2 answers
190 views

Query tags and setting up expressionengine to read from 2 databases

I know I can assign 2 databases through codeigniter. Is there a way to tell the query tags which database to pull the information from? I'm having to pull data from an external database.
brunam's user avatar
  • 311
2 votes
1 answer
448 views

sql subquery channel entry & matrix rows

I need to export channel entries with matrix data and having problems joining the entry id with my matrix subquery This is the matrix subquery which adds up my rows: SELECT exp_matrix_data.entry_id, ...
user2288448's user avatar
2 votes
1 answer
236 views

Pagination using the Query Module or Active Record Plugin

I have a custom table exp_jobs which I am querying. I have used {exp:query} and have also been trying out http://devot-ee.com/add-ons/activerecord ... Having 1 issue which I think could be solved a ...
Brian Peddle's user avatar
2 votes
1 answer
111 views

List where our members come from (country)

I've been trying to make a list of where our EE members comes from (country) and later on I will plot this data in to a Google Map to make it more interesting. For the moment I've only come up with ...
John Roe's user avatar
2 votes
1 answer
53 views

Extending expiry dates of certain entries?

A third party is providing an XML feed of courses for me to integrate into an existing channel, which I'm planning to use Andrew Weaver's excellent Datagrab module for. My problem is that some of ...
BellamyStudio's user avatar
1 vote
1 answer
2k views

How to add categories to a SQL query that outputs channel entry data

I'm trying to create a query that will output all the entries in a channel. I'm wanting to output the title, some custom fields, and the categories that the entry belongs to. Each entry will belong to ...
Stephen's user avatar
  • 1,349
1 vote
1 answer
108 views

Get query of exp:channel

Can I get the sql query after calling exp:channel. I want to see the query behind an exp:channel call? Is this possible by any debugging process? Thanks
Dhanu's user avatar
  • 139
1 vote
2 answers
105 views

How to highlight 10 most recent entries from a channel?

I'm trying to find a way to highlight the 10 most recent entries within an alphabetically sorted list of entries from a particular channel. I don't wish to change the order of the entries, just have ...
foamcow's user avatar
  • 7,176
1 vote
1 answer
122 views

How to use an SQL query to display entries from last 45 days

I'm using the following SQL query to populate a filter form for a jobs site. The query displays all locations used in the jobs listed on the site. I'm only displaying jobs up to 45 days old on the ...
Tom Perkins's user avatar
1 vote
1 answer
96 views

MX Select Plus CE - problems with SQL Query

I've added MX Select Plus CE in a Matrix row. The objective is when the user is digitizing inside the select options, appears "on the fly" the "title" of theses entries of a specific channel. I chose ...
Stéphane's user avatar
  • 885
1 vote
2 answers
127 views

Create a list of entries where parents status is open

I have 2 channels, artists and artwork. I want to display the artwork entries where their parent entry, in the artists channel, has the status set to 'open'. I would like to show all the fields from ...
zizther's user avatar
  • 320
1 vote
1 answer
83 views

Can't save templates containing Query tags

I've set up a staging server for an existing EE2 website, when I make changes to templates and save most templates save ok, but when I try to save a template that has an EE query tag, I get the ...
wot's user avatar
  • 321
1 vote
2 answers
3k views

SQL SELECT using custom field name (not ID) in WHERE

Forgive me if I missing something obvious, but I have a need to select channel entries from the EE database, but I want to select those entries based on a value assigned to one of my channels custom ...
Adam Christianson's user avatar
1 vote
1 answer
684 views

Getting a file directory tag {filedir_1} out of a query module result

I'm using a query module to get the results of a channel entry. I've retrieved the correct url: {filedir_1}/newimages/img1.png but it does not replace the {filedir_1} with the necessary prefix like ...
ekard9's user avatar
  • 79
1 vote
1 answer
83 views

What is the best way to set geolocalised variables?

I have a site that was happily outputting variables based upon a user's IP address. I was using code that looked to see if a cookie for a user's region was already set and if not, looking up the user'...
Jonathan Schofield's user avatar
1 vote
1 answer
201 views

Create an entry from an extension?

Is it possible to use the model service to create a new entry? I have been using the model service recently to update and delete channel entries, but can't figure out how to create. $update_query = ...
ccdavies's user avatar
  • 455
1 vote
2 answers
132 views

Removing duplicate entries using an SQL query

I'm trying to create a search field (using Solspace Super Search) using a location from existing channel entries. Unfortunately this results in duplicate locations as some entries use the same ...
Tom Perkins's user avatar
1 vote
1 answer
27 views

can you show screen_name of users who have liked an entry?

Channel Ratings: 4.0.4, EE: 2.7.3 I am using the channel ratings "Like" function, so the logged in users can "Like" certain products. I want to be able to display who has liked an entry. I am using ...
Funkefied's user avatar
  • 413
1 vote
1 answer
156 views

Building a list of entries from a single category with exp:query

I'm trying to speed my site up with a few direct queries. Like: {exp:query sql="SELECT field_id_16 FROM exp_channel_data WHERE channel_id='4' "} {field_id_16} {/exp:query} What query will ...
noregt's user avatar
  • 422
1 vote
2 answers
659 views

Embed variables in the Query Module for expressionengine

Having an issue with the following sql within the query module. SELECT exp_channel_titles.entry_id, exp_channel_titles.title, exp_channel_titles.url_title, exp_channel_titles.status, ...
ekard9's user avatar
  • 79
1 vote
1 answer
126 views

Running a query within a class method

So i'm looking at http://ellislab.com/expressionengine/user-guide/development/usage/database.html I've used $query = $this->EE->db->query("SELECT channel_name FROM exp_channels"); many ...
ipixel's user avatar
  • 247
1 vote
1 answer
110 views

Can I use a 'Select' Statement in my EE 2.5 template

I am trying to use a SELECT statement to call in some information. CODE: $qry = $this->EE->db->query('SELECT col_id_1, col_id_2, col_id_3 FROM exp_matrix_data'); I get this error when I try to use ...
JayB's user avatar
  • 59
1 vote
1 answer
249 views

Channel Entries: DISTINCT and COUNT

Given Channel entries, is there a way to get a list of unique entries in a text field and how many times that entry exist? For example, say the Channel contains the field first_name (FT is text) and ...
ExpressionEngineNewbie's user avatar
1 vote
1 answer
175 views

Getting Channel Entry Data With AJAX

EE 5.2.2 I am making an app that lists channel entries in a template. Some of the data in these entries could be very substantial so I would like to only call that data if/when the user chooses. The ...
Shayne's user avatar
  • 317
1 vote
1 answer
66 views

Need query that filters entries by category

I need to display entries from Channel 1 and entries from (Channel 2, Category 1). I'm guessing the meat of the query would be something like this: WHERE channel_id = 1 OR (channel_id = 2 AND cat_id ...
pedalGeoff's user avatar
1 vote
1 answer
160 views

URL segmentation GoDaddy

I have a problem with GoDaddy hosting. It seems that URL segmentation is not working, so I get link like this http://example.com/?/main/url_title and I need link like this http://example.com/main/...
BSheep's user avatar
  • 25
1 vote
2 answers
78 views

Playa related entries count

We are running reports and need a query - we're using playa and I want to get the total number of child_entries where channel_id = 16 and where the 'parent_field_id' = 68. My current query is: ...
paulcripps's user avatar
1 vote
1 answer
230 views

Limiting results returned by nested playa parents tags

I'm hoping someone can give me a pointer on narrowing my returned entries on the basis of nested playa parent relationships. Here's the scoop: I have a 4 inter-related channels: companies, people, ...
Jean St-Amand's user avatar