function and class to show image not working in php

Posted by Gully on Stack Overflow See other posts from Stack Overflow or by Gully
Published on 2010-05-04T10:44:06Z Indexed on 2010/05/04 10:48 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

i am trying to get get the following working nothing is happen when i use the function i am trying to get it to display images

 class ItemRes {
//items DB
var $img="";


}
 function ShowItemImage($index,$res_a){
 if(sizeof($res_a) > $index){
 if($res_a[$index] != NULL) {
     $cimg = $res_a[$index]->img;
     return "<img src='$cimg' width='70' height='70' style='cursor:pointer'></img>";
 }
 }else{
     return "<center class='whitetxt'><strong>Empty</strong></center>";
 }
  }



 $res_array = array();
 $idx=0;
  $result21 = mysql_query("SELECT * FROM photos WHERE eid='$eid' ORDER BY id DESC") or die (mysql_error()); 
  while ($row21 = mysql_fetch_array($result21)) { 
  $img_path = $row21['path'];
  $obj = new ItemRes();
  $obj->img = $img_path;
  $res_array[$idx] = $obj;
 $idx++;
 }

 ShowItemImage(0,$res_array)
 ShowItemImage(1,$res_array)

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql