error filtering results with relationship
-
Hi,
i wish you could help me with this problem. I’ve installed the version 2.3.4 and i’m not able to filter some results i’m getting from pods.This is the scenario for a discography database:
1. Custom post type called “albumes” where i add music albums information (covers, title, tracklist and more)
2. Second Custom post type called “canciones” where i add songs information (title, mp3 url, etc) with a relationship field with the pod “albumes”.So, this is the code i’m using to display the songs in the details page of the album (without filtering them):
$canciones = new Pod(‘canciones’);
$canciones->findRecords(‘orden ASC’,-1);
while ($canciones->FetchRecord()){
//get the title
$titulo_cancion = $canciones->get_field(‘name’);
//get the url
$fichero = $canciones->get_field(‘fichero’);
echo $titulo_cancion; //show the song title
}Ok, this is shown as expected but i need to show the songs from the actual album, not every song is in the table.
So if i change:
$canciones->findRecords(‘orden ASC’,-1);
to this:
$canciones->findRecords(‘orden ASC’,-1, “albumes.name = ‘”.$titulo_album.”‘”);
then i recieve this error:Database Error; SQL: SELECT DISTINCT
t
.* FROMdos_posts
ASt
LEFT JOINdos_postmeta
ASorden
ONorden
.meta_key
= ‘orden’ ANDorden
.post_id
=t
.ID
WHERE ( (albumes
.name
= ‘Fear (LP)’ ) AND (t
.post_type
= “canciones” ) ) ORDER BYorden
.meta_value
ASC,t
.menu_order
,t
.post_title
,t
.post_date
; Response: Unknown column ‘albumes.name’ in ‘where clause’.What am i doing wrong??
Please, help.Thank you very much!
- The topic ‘error filtering results with relationship’ is closed to new replies.