Каталог товаров

Каталог товаров и услуг с описаниями и предложениями от лучших компаний!

Фото товара PHP notice

PHP notice

Uninitialized string offset: -6

/var/www/public_zon.by/web/public_http/catalog.php(92)

080 <?php
081 if($nall == true){
082 foreach ($categorylistsql as $categorysql) {
083 $catid = $categorysql['id'];
084 $getProductSql = "SELECT * FROM `product` WHERE `cat_id`='$catid'  ORDER BY RAND() LIMIT 4";
085     $rec_productlist = $connection->CreateCommand ( $getProductSql );
086     $productlist = $rec_productlist->queryAll ();
087     foreach ($productlist as $product) {
088         ?>
089                             <?php
090                             $p = strrpos( $product['product_image'], '.');
091 
092                             $d1 = $product['product_image'][$p-6] . $product['product_image'][$p-5];
093                             $d2 = $product['product_image'][$p-4] . $product['product_image'][$p-3];
094                             $d3 = $product['product_image'][$p-2] . $product['product_image'][$p-1];
095 
096                             $pimage['path'] =   $d1.'/'.$d2.'/'.$d3.'/';
097                             ?>
098         <div class="col-sm-3 portfolio-item animation-fadeInQuick" data-category="<?php echo 'c' . $categorysql['id']; ?>">
099             <a href="product_single.php?id=<?php echo $product['id']; ?>">
100                 <img src="http://sqa.zon.by/<?php echo $pimage['path'].$product['product_image']; ?>"  width="480" height="720" alt="Фото товара" class="img-responsive">
101                 <span class="portfolio-item-info"><strong><?php echo $product['product_name']; ?> (<?php echo $product['brand']; ?>)</strong></span>
102             </a>
103         </div>
104         <?php

Stack Trace

#2
+
 /var/www/public_zon.by/web/public_http/catalog.php(92): CApplication->handleError(8, "Uninitialized string offset: -6", "/var/www/public_zon.by/web/public_http/catalog.php", 92, ...)
87     foreach ($productlist as $product) {
88         ?>
89                             <?php
90                             $p = strrpos( $product['product_image'], '.');
91 
92                             $d1 = $product['product_image'][$p-6] . $product['product_image'][$p-5];
93                             $d2 = $product['product_image'][$p-4] . $product['product_image'][$p-3];
94                             $d3 = $product['product_image'][$p-2] . $product['product_image'][$p-1];
95 
96                             $pimage['path'] =   $d1.'/'.$d2.'/'.$d3.'/';
97                             ?>