Good morning all, happy thursday morning. I wish I could have done this by myself but since I'm not a master in MySQL statements (yet) and I got lost in this DELETE query, here it goes...
I have to do a simple DELETE query like this, (deleting a comment by its id)
DELETE FROM mya_news_comments WHERE comment_id='".$_GET['comment_id']."'";
but at the same time, to prevent people deleting comments throughout the website i need to ensure that the person deleting this comment is who it is supposed to be (in our case, an artist).
I have another table mya_news which has among the fields news_id, artist_id
In mya_news_comments I also have a field called news_id
So I need to check that I delete the comment_id of the particular artist, not of other artist.
Basically i need to cross-check if the news_id field from mya_news_comments checks out with a field with same news_id from mya_news, and artist_id from mya_news is equal to $_id (which holds my artist_id)
I'm really stuck here. I'd be glad to give more details if needed.
Thanks.
mysql_real_escape_string(), if you ABSOLUTELY cannot use prepared statements. Everything is better what you do here...