I would like to see images in a data table column that contains URL links to wp content images. The query generated table succeeds in returning URLs, but I don't see how to make the column into an "image" column that will display the images ?
I am a little confused perhaps about the syntax. There is only one " double quote in your code example ??.
Here is my sub-query: (this line works to produce URLs)
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1) as pix_URL
Do you supposed that adding the concat function within the subquery will work ? I am only able to get syntax error results so far. Perhaps I am using the wrong quote types, or ??
here is code that does not work:
(select CONCAT ("<img src=", meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = user_meta_image' limit 1),">" ) as pix
here is the little site sql query response to the above code;
My site is on flywheel, and says that it is using InnoDB .
But to answer your first question, that is correct, and the table output correctly has a column name pix_URL with URLs to wp content .jpg images. Without the concat function, I do get URLs and a table.
Sorry about the quotes, I was typing from my phone. The code should be:
SELECT column1,
column2,
CONCAT('<img src="',table.image_column,'">') as image
FROM table
I would not recommend adding the CONCAT in a subquery because we use a PHP SQL parser and it doesn't work well with subqueries, JOIN, UNION, etc. functions. Even CONCAT can cause some issues, but not in the form mentioned in my response.
Can you please show me the query that displays the URL in the table?
THe code line added to the below listed (in error message post) overall query is also listed below.
Here is the query that works:
SELECT u.id , u.user_login, u.user_email,
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'first_name' limit 1) as first_name, (select meta_value from `wp_g1bf3tkaah_usermeta`where user_id = u.id and meta_key = 'last_name' limit 1) as last_name, (select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1) as pix_URL FROM wp_g1bf3tkaah_users AS u
Here is the modification that doesn't work: (to the third subquery)
(select CONCAT ("<img src=", meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = user_meta_image' limit 1),">" ) as pix
(This is not with added syntax change from your lates post. I'm just providing the inputs you requested)
Here is a screenshot of the table generated from the working query:
The desired outcome is for the pix_url column show the target URL graphic, and not a link.
(select CONCAT ('<img src="', meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1)'">') as pix_URL
and here is what the flywheel sql sandbox error message returns as the line with syntax error:
(select CONCAT ('') as pix
Perhaps others could benefit from a table editing tool that allows a table structure column to be converted to "image" ? Instead of jamming that process into the query ?
SELECT
u.id ,
u.user_login,
u.user_email,
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'first_name' limit 1) as first_name,
(select meta_value from `wp_g1bf3tkaah_usermeta`where user_id = u.id and meta_key = 'last_name' limit 1) as last_name,
CONCAT('<img src="',(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1),'">') as pix_URL
FROM wp_g1bf3tkaah_users AS u
I just tried it locally, and it works (see the attached screenshot).
However, even without this, if the "pix_URL" contains the URL to the image, you can go into this column's settings, and under the "Data" tab, change the type from "String" to "Image":
That also works, without CONCAT (the 2nd screenshot attached to my response).
Unfortunately, when I edit the table and then click on the "settings" button, and the data tab, for the pix_URL column that contains the picture urls I want to show, I get a different result:
Thank you for trying the CONCAT syntax, that will also work, but I would like to take a look at your website.
You most likely have a conflict with some other plugin, as I suppose not only "Data", but the other tabs as well (Sorting, Filtering, Conditional Formatting) will also be blank.
Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
I would like to see images in a data table column that contains URL links to wp content images. The query generated table succeeds in returning URLs, but I don't see how to make the column into an "image" column that will display the images ?
Hey David.
If I understood correctly, the images paths are correct in the database and you just need to make them appear as images?
If that's true, all you need to do is use the CONCAT function in the query.
For example:
You can also take a look at the video we created for the CONCAT function here.
I hope that helps.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
I am a little confused perhaps about the syntax. There is only one " double quote in your code example ??.
Here is my sub-query: (this line works to produce URLs)
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1) as pix_URL
Do you supposed that adding the concat function within the subquery will work ? I am only able to get syntax error results so far. Perhaps I am using the wrong quote types, or ??
here is code that does not work:
(select CONCAT ("<img src=", meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = user_meta_image' limit 1),">" ) as pix
here is the little site sql query response to the above code;
My site is on flywheel, and says that it is using InnoDB .
But to answer your first question, that is correct, and the table output correctly has a column name pix_URL with URLs to wp content .jpg images. Without the concat function, I do get URLs and a table.
Hi David
Sorry about the quotes, I was typing from my phone. The code should be:
I would not recommend adding the CONCAT in a subquery because we use a PHP SQL parser and it doesn't work well with subqueries, JOIN, UNION, etc. functions. Even CONCAT can cause some issues, but not in the form mentioned in my response.
Can you please show me the query that displays the URL in the table?
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
THe code line added to the below listed (in error message post) overall query is also listed below.
Here is the query that works:
SELECT
u.id ,
u.user_login,
u.user_email,
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'first_name' limit 1) as first_name,
(select meta_value from `wp_g1bf3tkaah_usermeta`where user_id = u.id and meta_key = 'last_name' limit 1) as last_name,
(select meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1) as pix_URL
FROM wp_g1bf3tkaah_users AS u
Here is the modification that doesn't work: (to the third subquery)
(select CONCAT ("<img src=", meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = user_meta_image' limit 1),">" ) as pix
(This is not with added syntax change from your lates post. I'm just providing the inputs you requested)
Here is a screenshot of the table generated from the working query:
The desired outcome is for the pix_url column show the target URL graphic, and not a link.
I'll try your syntax now and see what happens
here is the replacement CONCAT subquery line:
(select CONCAT ('<img src="', meta_value from `wp_g1bf3tkaah_usermeta` where user_id = u.id and meta_key = 'user_meta_image' limit 1)'">') as pix_URL
and here is what the flywheel sql sandbox error message returns as the line with syntax error:
Perhaps others could benefit from a table editing tool that allows a table structure column to be converted to "image" ? Instead of jamming that process into the query ?
Hey David.
Do it like this:
I just tried it locally, and it works (see the attached screenshot).
However, even without this, if the "pix_URL" contains the URL to the image, you can go into this column's settings, and under the "Data" tab, change the type from "String" to "Image":
That also works, without CONCAT (the 2nd screenshot attached to my response).
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thanks very much, I appreciate it. Let me go give it a try!
Unfortunately, when I edit the table and then click on the "settings" button, and the data tab, for the pix_URL column that contains the picture urls I want to show, I get a different result:
I don't have a choice of column data type .....
Hey David
You need to click on the "Data" tab in there:
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
That is what I did... I am not offered the choice of changing string to image.
here is what I see:
I'll try the most recent concat syntax.
Hello David
Thank you for trying the CONCAT syntax, that will also work, but I would like to take a look at your website.
You most likely have a conflict with some other plugin, as I suppose not only "Data", but the other tabs as well (Sorting, Filtering, Conditional Formatting) will also be blank.
Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
I will open a new private ticket with the info. I don't see anywhere to make this "private"
I'll get to your other ticket right away, David.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables