Jump to content

Syntax help


martyng

Recommended Posts

I read a recordset into an array and one part is shown below. I need to replace the numeral 1 with the variable picture, which i tried to do by just replacing 1 with $picture but can't get it work, any ideas

"link"=>"<A HREF=\"profile.php?id=$row[id]\"><IMG SRC=\"pictures/$row[gallery1]\" WIDTH=\"132\" HEIGHT=\"175\" BORDER=\"0\"></A>",
Link to comment
https://forums.phpfreaks.com/topic/11281-syntax-help/
Share on other sites

Still no luck, gallery1 refers to a row in a table. I also have a row called gallery2 and to create a random galery I have the random variable $picture with a value of either 1 or 2. The code works fine with a fixed [gallery1] or [gallery2] but not by trying to replace the 1 with $picture.


KrisNz's post looks closest to what i'm trying to do but still doesn't work giving the following
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in

Any ideas guys
Link to comment
https://forums.phpfreaks.com/topic/11281-syntax-help/#findComment-42334
Share on other sites

Nearly there, this doesn't produce an error but doesn't add the information contained in gallery$picture looking at the source code the image is just pictures/ with nothing tagged on

Any ideas



[!--quoteo(post=380530:date=Jun 6 2006, 03:57 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 6 2006, 03:57 AM) [snapback]380530[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]
"<a href=\"profile.php?id={$row['id']}\"><img src=\"pictures/{$row['gallery$picture']}\" width=\"132\" height=\"175\" border=\"0\"></a>";
[/code]
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/11281-syntax-help/#findComment-42448
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.