I'm new to php and sql. I have a table with three columns. One 256 bit hash number and two ints. I want to search for the row that matches my hash and then retrieve one int and increment the other. So, I thought I'd kill two birds with one stone by using first the UPDATE command.
$query = sprintf("UPDATE %s SET activationcount = (activationcount+1) WHERE hash='%s'", "activations", mysql_real_escape_string($hashv));
$result = mysql_query($query,$dbhandle);
then I use mysql_affected_rows to see if it was successful. If affected rows returns 1, then I know that it was present in the database and that its been auto-incremented. So far so good.
Now I want to retrieve another column in that row. Do I need to do a select to get the same row again or is the row somehow retrievable from the result object returned by my UPDATE command? I can't find a good example for this scenario.
This is basic stuff but it's all new to me.