mysql - Make SQL column using PHP explode into variable -



mysql - Make SQL column using PHP explode into variable -

hey guys i'm having bit of problem trying create sql column variable in php.

so sql row contains image url's , formatted this:

http://www.website.com/image.jpg,http://www.website.com/image2.jpg,http://www.website.com/image3.jpg

so need display first url in row.

i have short line of code:

file = '.(explode(',', $cardata["picturerefs"])[0]).';

i trying give variable value of:

$file = "http://www.website.com/image.jpg"

my current code wrong sense must quite close. how can accomplish this?

your short hand correct, string encapsulation not required.

$file = explode(',', $cardata['picturerefs'])[0]; // first image src

then can utilize like:

echo '<img src="'.$file.'"/>';

php mysql

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -