Jump to content

Trying to call up Posts that match the Tag in the Post to a keyword in my own data table...


Jim R

Recommended Posts

I assuming if you're here, you know WP table structure, but I also have two of my own tables called events and evaluations.  

Events columns are id, name, start, end, city, state, tag
Evaluations isn't really part of this issue.  

I have a WP Page with custom code drawing anything from Evaluations that matches the Event to the page.   Now, I would also like to list any WP Post that matches event.tag to this page.  

The error I'm getting:

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /home2/csi/public_html/wp-content/plugins/csi_reviews.php on line 970

So it's not finding any matches in the query, but I work it forward and back, the values line up.  So I'm clearly missing something. 

 

So the URL that reads like this...

webaddress.com/event/?event=18

$event = $_GET['event'];


$query = "SELECT *
	FROM wp_posts p
	
	LEFT JOIN wp_terms_relationships tr
		ON p.ID = tr.object_id
	LEFT JOIN wp_terms t
		ON tr.term_taxonomy_id = t.term_id	
	
	LEFT JOIN a_events e	
		ON e.tag = t.slug	
		
	WHERE e.id = '". $event ."'	
	";

 

p.ID = 1459
tr.object_id = 1459

tr.term_taxonomy_id = 1231
t.term_id = 1231

e.tag = mibfl
t.slug = mibfl

e.id = 18
$event = 18

 

Edited by Jim R
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.