Jump to content

Parse error - rendering array


mainstreetop

Recommended Posts

I have an array ($other_images) that contains image file names separated by semi colons.

 

I can successfully echo the individual values using echo $other_images[0], $other_images[1], $other_images[2]...

 

When I put it in a for loop, though, I run into the followng error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in...

 

Here is my code:

<?php

$other_images = explode(";", $data['ItemAltImage']);

for($i=0; $i<count($other_images); $i++)

{

  echo "<p><img src='http:\\www.oppictures.com\SINGLEIMAGES\100\" . $other_images[$i] . "' /></p>";

}

?>

 

This is the result of print_r($other_images):

 

Array ( [0] => UNV21200_3_2.JPG [1] => UNV21200_2_2.JPG [2] => UNV21200_4_1.JPG [3] => UNV21200_8_1.JPG [4] => UNV21200_5_1.JPG [5] => UNV21200_6_1.JPG [6] => UNV21200_7_1.JPG [7] => UNV21200_9_1.JPG )

 

Do you see where I'm making a mistake?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/229839-parse-error-rendering-array/
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.