Page 1 of 1

registration/email activation tut

Posted: Fri Dec 02, 2011 2:50 pm
by shaunthomson
Hi guys

Regarding the registration/email activation tut...

Say the user activates, and then they hit the activation link in their email again. Why does mysql NOT throw a warning after the
mysql_query("DELETE FROM `user_activations` WHERE `activation_code` = '{$aid}'");
query? ie - the activation code that you're asking it to delete isn't there anymore - so shouldn't a warning or some sort of error come up?

I ask as I've added more things to complete in the activation, each one checking for an error. I noticed that clicking the activation link AFTER the account has been activated resulted in processes in my code being carried out that shouldn't if the user is already activated.

Thanks again!

Shaun

Re: registration/email activation tut

Posted: Sat Dec 03, 2011 7:02 pm
by jacek
Because it is not an error.

This of the process the server goes through when deleting rows, first it will check for all rows that match the condition after the WHERE part, then it will delete all of those rows. If there are no matching rows, it just exits.

Re: registration/email activation tut

Posted: Sun Dec 04, 2011 1:14 am
by shaunthomson
Ahh - thanks Jacek. I've set it up to test for the number of rows now.

Thanks again for the tuts - I knew nothing about accessing and interacting with mysql before, but now am able to make something useful.

Much appreciated

Shaun