Hi there folks:
My MySQL query refuses to co-operate with me and gives me the folowing error:
"1064: You have an error in your SQL syntax near 'vote_results WHERE DATE_ADD(vote_item.submitDate, INTERVAL 7 DAY) < CURDATE() AN' at line 1"
//The offending query is:
$delsql = "DELETE FROM $Titem,$Tresults WHERE DATE_ADD($Titem.submitDate, INTERVAL 7 DAY) < CURDATE() AND $Titem.itemid=$Tresults.id";
//It works fine if the query is simplified thus:
$delsql = "DELETE FROM $Titem WHERE DATE_ADD($submitDate, INTERVAL 7 DAY) < CURDATE()";
But the intention is to remove not only the item (2nd example above) but its associated values (1st example above).
Now the tail-end of the 1st example: 'AND $Titem.itemid=$Tresults.id' basically means:
'And delete from $Tresults where id equals $Titem id. In the only item I have in my DB at present both id's are the same, both are '1'.
Is there a way of modifing the 1st query above to do delete both item and values from their respective tables??
Many thanks for input of any kind!
Cheers
Russ