get image name from image field database in flexicontent

More
10 years 6 months ago - 10 years 5 months ago #51471 by rafah
Hi,

I want to write a custom sql query to get image name from image field in database.How to get this value.

I wrote this query

$myquery = 'SELECT value FROM xrlwc_flexicontent_fields_item_relations WHERE field_id = 24 AND item_id = 4'

and I am getting result as

a:7:{s:12:"existingname";s:0:"";s:12:"originalname";s:17:"beauty-saloon.jpg";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:4:"desc";s:0:"";s:6:"delete";b:0;s:6:"remove";b:0;}


I want only beautysaloon.jpg with image path.

How can I do this?Please help
Last edit: 10 years 5 months ago by rafah.

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #51472 by ggppdk
Hello

you need to call PHP function
unserialize on the value
Code:
$value = unserialize($dbdata);


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #51474 by rafah
Hi thanks,

I tried this.But I am getting this error.

Notice: Array to string conversion in /var/www/html/joomla/components/com_flexicontent/templates/searchlistingpage/item.php on line 1587

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #51476 by ggppdk
Hello


you said above about 1 value and you pasted a string


if you want to do an array of value
then call PHP unserialize on every value:
Code:
$v = array(); foreach($dbdata as $d) { $v[] = unserialize($d); }


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #51478 by rafah
Hi,

I took only one value in the query.Not array of values.But still I am getting this error. :(

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #51480 by ggppdk
Hello

do a

print_r($mydata);

does it print a string or an array with 1 value ??


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.376 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save