最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Hyperlinks stopped displaying properly from php code for Directory

programmeradmin1浏览0评论

The following code has always worked on our site, allowing for the display words to be shown representing the attached hyperlink URLs. Recently, our site is showing both the display word AND the URL of the hyperlink following it.

For example, the word "Resume" previously would be displayed as a hyperlink to the file "cv.value" Now the site reads: Resume cv.value

We haven;t changed anything on our end. Running WP v6.7.2, Dynamic User Directory v2.1, Insert php code snippet v1.4.1

Would love to know how to edit the following php snippet to make it work again.

php snippet:

<?php

// create a file pointer connected to the output stream
unlink('wp-content/uploads/TeachersDirectory.csv');
$csvoutput = fopen('wp-content/uploads/eachersDirectory.csv', 'w');

// add to SELECT if requested:
// , COALESCE(cv.value, '') AS 'Resume', COALESCE(imdb.value, '') AS 'IMDB'
$query = "SELECT users.display_name AS 'Name', users.user_email AS 'Email Address', COALESCE(phone.value, '') AS 'Phone' FROM  wp_3gwns004cx_users users LEFT JOIN (SELECT user_id, value FROM  wp_3gwns004cx_bp_xprofile_data WHERE field_id = 19) phone ON phone.user_id = users.id LEFT JOIN (SELECT user_id, CONCAT('/', value) AS 'value' FROM  wp_3gwns004cx_bp_xprofile_data WHERE field_id = 3 AND value <> '') cv ON cv.user_id = users.id LEFT JOIN (SELECT user_id, value FROM  wp_3gwns004cx_bp_xprofile_data WHERE field_id = 5) imdb ON imdb.user_id = users.id LEFT JOIN  wp_3gwns004cx_usermeta usermeta ON users.id = usermeta.user_id LEFT JOIN (SELECT user_id, meta_value FROM  wp_3gwns004cx_usermeta WHERE meta_key = 'last_name') lnametable ON lnametable.user_id = users.id WHERE usermeta.meta_value = 'a:1:{s:10:\"subscriber\";b:1;}' GROUP BY users.display_name ORDER BY lnametable.meta_value ASC;";

// output the column headings
//fputcsv($csvoutput, array('Name', 'Email Address', 'Phone', 'Resume', 'IMDB'));
fputcsv($csvoutput, array('Name', 'Email Address', 'Phone'));

// fetch the data
$db = mysqli_connect('f82444021589530.db.44021589.8dc.hostedresource', 'f82444021589530', 'R1*Ju!Og', 'f82444021589530', 3313);
$rows = mysqli_query($db, $query);

// loop over the rows, outputting them
while ($row = mysqli_fetch_assoc($rows)) {
    fputcsv($csvoutput, $row);
}

// close the file
fclose($csvoutput);

// output the headers so we download the file
    //header('Content-Type: text/csv; charset=utf-8');
   // header('Content-Disposition: attachment; filename=TeachersDirectory.csv');
// download the file
    //readfile("TeachersDirectory.csv");
发布评论

评论列表(0)

  1. 暂无评论