colinhughes — 2013-07-13T11:25:57-04:00 — #1
$sql = "SELECT `propertyref` FROM `feed_property` WHERE `status` = 'Sold' OR `status` = 'Off Market' ";
$result = $db->query($sql);
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; ";
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?
lorenw — 2013-07-13T12:25:56-04:00 — #2
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.
colinhughes — 2013-07-13T15:22:39-04:00 — #3
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?
lorenw — 2013-07-16T13:00:42-04:00 — #4
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?