PHP Code:
 $sql "SELECT `propertyref` FROM `feed_property` WHERE `status` = 'Sold' OR `status` = 'Off Market' ";
    
$result $db->query($sql);

    if (isset(
$result)):
        while (
$row $result->fetch_array(MYSQLI_ASSOC)):
            
$ref1 $db->real_escape_string($row['propertyref']);

              
$query1 "DELETE FROM `feed_property`, `feed_images`, `feed_characteristics`\n"
            
"USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics`\n"
            
"WHERE feed_property.propertyref = '$ref1'\n"
            
" AND feed_images.propertyref = feed_property.propertyref\n"
            
" AND feed_characteristics.propertyref = feed_property.propertyref; ";
            
            
            
            
$db->query($query1);

        endwhile;
    endif; 
I cannot understand why the delete query works on my test server but not on my production server? On the latter it deletes the images and characteristics associated with an off market or Sold property, but it will not delete the property itself.



Any insight as to why this might be?

TIA