I have this URL:
<img src="https://graph.facebook.com/number/picture">
In the place of number I want to put a SESSION variable.How am I going to do it?
I have tried various syntax…without success…one of them is the one below.
<img src="https://graph.facebook.com/"<?php echo $_SESSION['fb_userID']; ?>"/picture">
What is the correct syntax for embedding a variable in this URL above?
I’d imagine the problem is the extra quotation marks before and after your embedded PHP code - once the sessionID is in place it reads like this:
<img src="https://graph.facebook.com/"050340"/picture">
I’d do this instead, but just because I don’t like PHP embedded within a line, you could probably just lose those quotes.
$url = "https://graph.facebook.com/" . $_SESSION['fb_userID'] . "/picture";
echo '<img src="' . $url . '">';
system
Closed
July 9, 2016, 1:18am
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.