Jump to content

Recommended Posts

PHP Warning:  Illegal string offset 'url' in /hotel_details.php on line 164
PHP Warning:  Illegal string offset 'thumbnailUrl' in /hotel_details.php on line 164
PHP Warning:  Illegal string offset 'thumbnailUrl' in /hotel_details.php on line 166
PHP Warning:  Illegal string offset 'url' in /hotel_details.php on line 167
PHP Warning:  Illegal string offset 'url' in /hotel_details.php on line 177



Here is the code in question from lines 153 to 180

<!-- Elastislide Carousel -->
               <ul id="carousel" class="elastislide-list">
               <!--<ul >-->
                <?php
                if($respon['HotelInformationResponse']['HotelImages']['HotelImage'] !="")
                {
                $i= 0;
                foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img)
                {
                    $i++;
                ?>
                    <li data-preview="<?php echo $img['url']; ?>" id="pr_<?php echo $i;?>"><a href="javascript:void(0);" ><img src="<?php echo $img['thumbnailUrl']; ?>" alt="image-preview" id="anc_<?php echo $i;?>" onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/></a></li>
                    
                     <!--<li><img src="<?php echo $img['thumbnailUrl']; ?>" alt="" height="70" width="70"  onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/>
                    <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/></li>-->
                <?php } ?>
               <!--</ul>-->
              </ul>
               <?php
                $i= 0;
                foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img)
                {
                    $i++;
               ?>                    
                    <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/>
                <?php } }
                ?>
                <!-- End Elastislide Carousel -->

Hi All

 

I am receiving this error and I have no idea what to do, any ideas what could be wrong

 

 

thanks in advance

 

 

Link to comment
https://forums.phpfreaks.com/topic/294844-illegal-string-offset-php-error/
Share on other sites

one could change

 foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img)

to 

 foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $index => $img)

and it "should" work. as long as there is data in the $img array

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.