Delete works on my test server and not on my production server?

 $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`\
"
            . "USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics`\
"
            . "WHERE feed_property.propertyref = '$ref1'\
"
            . " AND feed_images.propertyref = feed_property.propertyref\
"
            . " 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

All I can think of is that your production server may have limited database privileges.
In phpmyadmin, click on the Privileges tab to see what you are allowed to do.

I do not have access to the privileges tab, shared hosting. Can you explain why this would be the problem it deletes 2 of the 3 “FROMS” in the query?

At first I read the title and did not get that is was leaving one entry.
Could it be that you are missing
ant the end of $query1?