Jane thanks alot for your reply and help!
I'm almost done I feel...but the code which I put in the 'view on load' is setting stop for the end result,
My Test table is this:
Table's name: TableName
field 1: ID
field 2: Photo1
field 3: Photo2
field 4: Photo3
I clicked on the custom code and inserted this code(view on load):
I copied changed and put this code in the 'view on load' in the events page(PHPR)!
global $conn,$smarty;
$rstt = db_fetch_array($pic);
$pic="";
if($rstt["Photo1"]!="")
$pic=$rstt["Photo1"];
else if($rstt["Photo2"]!="")
$pic=$rstt["Photo2"];
else if($rstt["Photo3"]!="")
$pic=$rstt["Photo3"];
if($pic=="")
$smarty->assign("row00firstphoto_value",htmlspecialchars("images\\no_image.gif"));
else
$smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic)));
And I've got this error at the view page(picture below):

The whole code from the 'RealEstate project was this:
global $conn,$smarty;
$data = db_query("select tblresults.*, tblcooling.Cooling as strCooling, tblheating.Heating as strHeating, tbltype.Type as strType, tblstyle.Style as strStyle from tblresults left join tblcooling on tblcooling.CoolingID=tblresults.Cooling left join tblheating on HeatingID=tblresults.Heating left join tbltype on TypeID=tblresults.Type left join tblstyle on StyleID=tblresults.Style where PropertyID=".$_REQUEST["editid1"],$conn);
$rstt = db_fetch_array($data);
$smarty->assign("show_Type",$rstt["strType"]);
$smarty->assign("show_Style",$rstt["strStyle"]);
$smarty->assign("ch_Kitchen",$rstt["Kitchen"]);
$smarty->assign("ch_Living_Room",$rstt["Living_Room"]);
$smarty->assign("ch_Family_Room",$rstt["Family_Room"]);
$smarty->assign("ch_Rec_Room",$rstt["Rec_Room"]);
$smarty->assign("ch_Study_Room",$rstt["Study_Room"]);
$smarty->assign("ch_Sun_Room",$rstt["Sun_Room"]);
$smarty->assign("ch_Loft",$rstt["Loft"]);
$smarty->assign("ch_Amusement_Room",$rstt["Amusement_Room"]);
$smarty->assign("ch_Foyer",$rstt["Foyer"]);
$smarty->assign("ch_Office",$rstt["Office"]);
$smarty->assign("ch_Den",$rstt["Den"]);
$smarty->assign("ch_Dinning_Room",$rstt["Dinning_Room"]);
if(is_null($rstt["FullBaths"]))
$smarty->assign("ch_FullBaths",False);
else if($rstt["FullBaths"]==0)
$smarty->assign("ch_FullBaths",False);
else
$smarty->assign("ch_FullBaths",True);
if(is_null($rstt["3/4Baths"]))
$smarty->assign("ch_3_4Baths",False);
else if($rstt["3/4Baths"]==0)
$smarty->assign("ch_3_4Baths",False);
else
$smarty->assign("ch_3_4Baths",True);
if(is_null($rstt["1/2Baths"]))
$smarty->assign("ch_1_2Baths",False);
else if($rstt["1/2Baths"]==0)
$smarty->assign("ch_1_2Baths",False);
else
$smarty->assign("ch_1_2Baths",True);
if($rstt["Wood_Burning_Fireplace"]==0)
$smarty->assign("ch_Wood_Burning_Fireplace",False);
else
$smarty->assign("ch_Wood_Burning_Fireplace",True);
if($rstt["Gas_Burning_Fireplace"]==0)
$smarty->assign("ch_Gas_Burning_Fireplace",False);
else
$smarty->assign("ch_Gas_Burning_Fireplace",True);
if($rstt["Range"]==0)
$smarty->assign("ch_Range",False);
else
$smarty->assign("ch_Range",True);
if($rstt["Cooktop"]==0)
$smarty->assign("ch_Cooktop",False);
else
$smarty->assign("ch_Cooktop",True);
if($rstt["Dishwasher"]==0)
$smarty->assign("ch_Dishwasher",False);
else
$smarty->assign("ch_Dishwasher",True);
if($rstt["Disposal"]==0)
$smarty->assign("ch_Disposal",False);
else
$smarty->assign("ch_Disposal",True);
if($rstt["Dryer"]==0)
$smarty->assign("ch_Dryer",False);
else
$smarty->assign("ch_Dryer",True);
if($rstt["Exhaust_Fan/Hood"]==0)
$smarty->assign("ch_Exhaust_Fan_Hood",False);
else
$smarty->assign("ch_Exhaust_Fan_Hood",True);
if($rstt["Eat_In_Kitchen"]==0)
$smarty->assign("ch_Eat_In_Kitchen",False);
else
$smarty->assign("ch_Eat_In_Kitchen",True);
if($rstt["Kitchen/Dining_Room"]==0)
$smarty->assign("ch_Kitchen_Dining_Room",False);
else
$smarty->assign("ch_Kitchen_Dining_Room",True);
if($rstt["Separate/Formal_Dining_Room"]==0)
$smarty->assign("ch_Separate_Formal_Dining_Room",False);
else
$smarty->assign("ch_Separate_Formal_Dining_Room",True);
if($rstt["Microwave"]==0)
$smarty->assign("ch_Microwave",False);
else
$smarty->assign("ch_Microwave",True);
if($rstt["Refrigerator"]==0)
$smarty->assign("ch_Refrigerator",False);
else
$smarty->assign("ch_Refrigerator",True);
if($rstt["Wall_Oven"]==0)
$smarty->assign("ch_Wall_Oven",False);
else
$smarty->assign("ch_Wall_Oven",True);
if($rstt["Water_Softener"]==0)
$smarty->assign("ch_Water_Softener",False);
else
$smarty->assign("ch_Water_Softener",True);
if($rstt["Basement"]==0)
$smarty->assign("ch_Basement",False);
else
$smarty->assign("ch_Basement",True);
if($rstt["Finished_Basement"]==0)
$smarty->assign("ch_Finished_Basement",False);
else
$smarty->assign("ch_Finished_Basement",True);
if($rstt["Walkout"]==0)
$smarty->assign("ch_Walkout",False);
else
$smarty->assign("ch_Walkout",True);
if($rstt["Sum_Pump"]==0)
$smarty->assign("ch_Sum_Pump",False);
else
$smarty->assign("ch_Sum_Pump",True);
if($rstt["Drain_Tiled"]==0)
$smarty->assign("ch_Drain_Tiled",False);
else
$smarty->assign("ch_Drain_Tiled",True);
if($rstt["Daylight/Lookout_Windows"]==0)
$smarty->assign("ch_Daylight_Lookout_Windows",False);
else
$smarty->assign("ch_Daylight_Lookout_Windows",True);
if($rstt["Cooling"]==0)
$smarty->assign("ch_Cooling",False);
else
{
$smarty->assign("ch_Cooling",True);
$smarty->assign("show_Cooling",$rstt["strCooling"]);
}
if($rstt["Heating"]==0)
$smarty->assign("ch_Heating",False);
else
{
$smarty->assign("ch_Heating",True);
$smarty->assign("show_Heating",$rstt["strHeating"]);
}
if($rstt["Lot"]==0)
$smarty->assign("ch_Lot",False);
else
$smarty->assign("ch_Lot",True);
if(is_null($rstt["Lot_Dimension1"]))
$smarty->assign("ch_Lot_Dimension1",False);
else if($rstt["Lot_Dimension1"]==0)
$smarty->assign("ch_Lot_Dimension1",False);
else
$smarty->assign("ch_Lot_Dimension1",True);
if(is_null($rstt["Lot_Dimension2"]))
$smarty->assign("ch_Lot_Dimension2",False);
else if($rstt["Lot_Dimension2"]==0)
$smarty->assign("ch_Lot_Dimension2",False);
else
$smarty->assign("ch_Lot_Dimension2",True);
if(is_null($rstt["Lot_Dimension3"]))
$smarty->assign("ch_Lot_Dimension3",False);
else if($rstt["Lot_Dimension3"]==0)
$smarty->assign("ch_Lot_Dimension3",False);
else
$smarty->assign("ch_Lot_Dimension3",True);
if(is_null($rstt["Lot_Dimension4"]))
$smarty->assign("ch_Lot_Dimension4",False);
else if($rstt["Lot_Dimension4"]==0)
$smarty->assign("ch_Lot_Dimension4",False);
else
$smarty->assign("ch_Lot_Dimension4",True);
if(is_null($rstt["Lot_Dimension5"]))
$smarty->assign("ch_Lot_Dimension5",False);
else if($rstt["Lot_Dimension5"]==0)
$smarty->assign("ch_Lot_Dimension5",False);
else
$smarty->assign("ch_Lot_Dimension5",True);
if(is_null($rstt["Lot_Dimension6"]))
$smarty->assign("ch_Lot_Dimension6",False);
else if($rstt["Lot_Dimension6"]==0)
$smarty->assign("ch_Lot_Dimension6",False);
else
$smarty->assign("ch_Lot_Dimension6",True);
if(is_null($rstt["Lot_Dimension7"]))
$smarty->assign("ch_Lot_Dimension7",False);
else if($rstt["Lot_Dimension7"]==0)
$smarty->assign("ch_Lot_Dimension7",False);
else
$smarty->assign("ch_Lot_Dimension7",True);
if(is_null($rstt["Lot_Dimension8"]))
$smarty->assign("ch_Lot_Dimension8",False);
else if($rstt["Lot_Dimension8"]==0)
$smarty->assign("ch_Lot_Dimension8",False);
else
$smarty->assign("ch_Lot_Dimension8",True);
$pic="";
if($rstt["Photo1"]!="")
$pic=$rstt["Photo1"];
else if($rstt["Photo2"]!="")
$pic=$rstt["Photo2"];
else if($rstt["Photo3"]!="")
$pic=$rstt["Photo3"];
else if($rstt["Photo4"]!="")
$pic=$rstt["Photo4"];
else if($rstt["Photo5"]!="")
$pic=$rstt["Photo5"];
else if($rstt["Photo6"]!="")
$pic=$rstt["Photo6"];
else if($rstt["Photo7"]!="")
$pic=$rstt["Photo7"];
else if($rstt["Photo8"]!="")
$pic=$rstt["Photo8"];
else if($rstt["Photo9"]!="")
$pic=$rstt["Photo9"];
if($pic=="")
$smarty->assign("row00firstphoto_value",htmlspecialchars("images\\no_image.gif"));
else
$smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic)));