Hi Everyone,
I have a random script that displays a image red x versus my No Picture Available image.
The script suppose to match the id of #__estateagent_object with the img_id of #
Now if no images have been uploaded there will be no img_id found in #__estateagent_images and should return the No Pic Available. But, its not working.
I think my IF STATEMENT is incorrect. Any suggestions would be gratefully appreciated.
[CODE]
$picturepath = $mosConfig_live_site.$ea_picpath.”/”;
$query=”SELECT * FROM #__estateagent_object WHERE obj_publish=’1′ ORDER BY rand() LIMIT 1″;
$database->setQuery( $query );
$rows = $database->loadObjectList();
$row=$rows[0];
$query1=”SELECT img_id, obj_img1 FROM #__estateagent_images WHERE img_id=$row->id “;
$database->setQuery( $query1 );
$rows1 = $database->loadObjectList();
$row1=$rows1[0];
$query2=”SELECT * FROM #__estateagent_category WHERE cat_id=$row->obj_cat”;
$database->setQuery( $query2 );
$rows2 = $database->loadObjectList();
$row2=$rows2[0];
if($img_id != ‘$row->id’) {
$sm_pic = “<img src='”.$picturepath.”thmb_”.$row1->obj_img1.”‘ border=’0′ alt=’$row->obj_title’>”;
}
else {
$sm_pic = “<img src='”. $mosConfig_live_site.”/components/com_estateagent/obj_pictures/nopic.png’ border=’0′ alt=’$row->obj_title’>”;
}
echo “<center><a href=’index.php?option=com_estateagent&Itemid=0&func=showObject&objid=$row->id’><b>$row2->cat_name</b><br/>$sm_pic<br/><font size=’1′>”.$row->obj_town.”, “.$row->obj_state.”</font></a></center>”;