PHP notice

Undefined offset: -1

/home/birdcom/domains/birdwatchingvietnam.net/public_html/protected/controllers/GalleryController.php(37)

25             $criteria = new CDbCriteria();
26             $criteria->order = 'birdID';
27             $criteria->condition = "photographer like '" . $searchby . "'";      
28             $criteria->select = '*';
29             $listbirdsimage = Birdimages::model()->findAll($criteria);
30             if($flag > count($listbirdsimage))
31                 $flag=count($listbirdsimage);
32         } else {
33             $listbirdsimage = NULL;
34         }
35         
36         $flag = $flag - 1;
37         $item = $listbirdsimage[$flag];
38         $src_image = $this->app->request->getBaseUrl(true) . '/images/bird/'  . $item->birdID . '/' . $item->birdimage;
39         $copyright = '<a href="' . $this->createAbsoluteUrl('photographer/index', array('title' => Helper::slug($item->photographer))) . '">'. $item->photographer . '</a>';
40         
41         if(strpos($item->birdname, "'") > -1) { 
42             $birdname = '<a href="' . $this->createAbsoluteUrl('birddetail/index', array('id' => $item->birdID, 'title' => Helper::slug($item->birdname), 'searchby' => 'english-name')) . '" target="_blank">' . str_replace("'", "&lsquo;", $item->birdname) . '</a>';
43         } else {
44             $birdname = '<a href="' . $this->createAbsoluteUrl('birddetail/index', array('id' => $item->birdID, 'title' => Helper::slug($item->birdname), 'searchby' => 'english-name')) . '" target="_blank">' . $item->birdname . '</a>';
45         }
46         
47         $datetaken = $item->datetaken;
48         if($item->gender == '1') {
49             $gender = 'Male'; // MALE

Stack Trace

#7
+
 /home/birdcom/domains/birdwatchingvietnam.net/public_html/index.php(12): CApplication->run()
07 defined('YII_DEBUG') or define('YII_DEBUG',true);
08 // specify how many levels of call stack should be shown in each log message
09 //defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
10 require_once($yii);
11 
12 Yii::createWebApplication($config)->run();
13 
14 
2024-03-29 04:57:44 Apache/2 Yii Framework/1.1.13