/    Sign up×
Community /Pin to ProfileBookmark

Path variable linking to field name"

Hi all,

I am learning (FAST).

In php if I set a var to “$foo = “images/files”;” as the path to my image directory and then I want to call the var in an echo statement, like:

<?php echo “<img src= “$foo” $row_midland_shires[‘coat_arms’]”; ?>”>

is this the correct way to write it?

Any help would be good.

Kind regards, keep safe and well.

Dereck

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@bokehAug 26.2005 — [code=php]<img src="<?php echo $foo.$row_midland_shires['coat_arms']"; ?>">[/code]
Copy linkTweet thisAlerts:
@dcjonesauthorAug 26.2005 — Hi and thanks,

I know it was simple but some days so am I, many thanks again

RESOLVED

Dereck
Copy linkTweet thisAlerts:
@dcjonesauthorAug 26.2005 — Hi bokeh (not so resolved)

If I use:

<img src="<?php echo $arms_image.$row_midland_shires['coat_arms']; ?>">

the result is:

<div align="center"><img src="images/coat_of_arms/"></div>

It show the path but not the file, and the file is in the path.

Any ideas.

Kind regards again, keep safe and well.

Dereck
Copy linkTweet thisAlerts:
@NogDogAug 26.2005 — Or...
[code=php]
<?php
echo "<img src='$foo/{$row_midland_shires['coat_arms']}'>";
# ... or ...
echo '<img src="' . $foo . '/' . $row_midland_shires['coat_arms'] . '">';
# ... or ...
echo <<<EOD
<img src="$foo/{$row_midland_shires['coat_arms']}">
EOD;

# ... or ...
$file = $foo . "/" . $row_midland_shires['coat_arms'];
echo "<img src='$file'>";
# ... or ...
# etc., etc., and so forth.....
?>
[/code]

As the Perl hackers always like to say, "There's more than one way to do it." ?
Copy linkTweet thisAlerts:
@dcjonesauthorAug 26.2005 — Hey Guys,

Thanks, its now working, my fault, I did not put the file name in the database.

Sorry for being an ass.

Kind regards, please keep safe and well.

Dereck
×

Success!

Help @dcjones spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...