YES! I believe we have a result.

That has done the trick, I had to remove the . from this though
PHP Code:
 $sql .= rtrim($sql' , '
else it threw an insert error. Did this work for you with the . in place?

I have also added this to images in case there is a property without images.
PHP Code:
function add_images($db$property) {
    if ( !empty(
$property->images) ): 
    
$sql "INSERT INTO feed_images (`propertyref`, `url`, `prime`, `pid`) VALUES ";
      
       
    
$property_id = (string)$property->id;
    foreach (
$property->images->image as $image):
    
        
        
$url     = (string)$image->url;
        
$prime   = (int)$image->primary;
        
$imageid = (int)$image['id'];
        
$pid     "$property_id-$imageid";
        
        
$sql .= "('".$property_id." ', '".$url."', '".$prime."', '".$pid."') , ";
        
    endforeach;
    
    
$sql rtrim($sql' , ') .  ' ON DUPLICATE KEY UPDATE url = VALUES (url), prime = VALUES (prime)';
    
    

    return 
$db->query($sql);
    
     endif;   
      
    return 
TRUE

Thanks so much for your help it is most appreciated. I will put it on the live server and check it out later.

Colin