collating variables from a wp database into a string
-
hello hive
i’m trying to collect variables from a mysql database into one comma-separated string from wordpress using php with limited expertise and your help would be much appreciated
my database has a table called wp_words_table, with cols: id, words_value, submit_id and item_id
i want to fetch all words_value data from rows where the submit_id equals 99 (there are many rows with 99 ids, as well as rows with other id numbers)
the words_value data could be a single word or phrase, or it could be a comma separated string of single words and/or phrases
i then want to collate this data into one comma separated string ($cloud9). i’ve cobbled the following from what i could glean from the internet, but i get the error: syntax error, unexpected identifier words_value, expecting )
global $wpdb;
global $cloud9;
$cloud9 = $wpdb->CONCAT_WS(‘,’, SELECT words_value FROM wp_words_table WHERE submit_id = 99);i’ve tried variations but keep getting the same error. i’m obviously doing something wrong, can anyone see what it is, please?
You must be logged in to reply to this topic.