In after or before store you can execute any php or joomla function, plus you have available some variables that you can alter (not important for your case), so generally this code should work if you sued the right database tables.
One thing that I would chage is
$artid=$_GET;
this won't work as get is an array, also this is not safe practice, in Joomla you need to use JInput which filters input variables by type (third parameter, second one is default value), so yo need to do
$artid = JFactory::getApplication()->input->get('id', 0, 'INT');