the_permalink in mysql query?
-
Posted originally in plugins and hacks with no answer yet. I’m trying to use the_permalink as the url of this query.
$result = mysql_query("SELECT link_title, link_destination, link_unique_clicks FROM wp_tracking_clicks, wp_tracking_links WHERE wp_tracking_clicks.link_id = wp_tracking_links.link_id AND wp_tracking_clicks.click_refer = 'https://www.url.com'"); while ($row = mysql_fetch_assoc($result)) { echo $row['link_title']; echo $row['link_destination']; echo $row['link_unique_clicks']; }
The code above works but I need to display this in a template, so I need to get the pages current url.
All attempts to put the_permalink directly, or into a variable and then pass it to the query fail. I’ve tried both
AND wp_tracking_clicks.click_refer = 'the_permalink'");
and
$link=the_permalink(); AND wp_tracking_clicks.click_refer = '$link'");
I’m sure I’m missing something simple but any help would be greatly appreciated.
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘the_permalink in mysql query?’ is closed to new replies.