I am new to php and sql. I have a table with three columns. One 256-bit hash number and two inputs. I want to find a string that matches my hash, and then restore one int and increase it. So, I thought that I would kill two birds with one stone, using the UPDATE command first.
$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 make sure it was successful. If the affected rows return 1, I know that it is present in the database and that it was automatically added. So far, so good.
Now I want to get another column in this row. Do I have to make a choice to get the same row again or some row retrieved from the result object returned by my UPDATE command? I can not find a good example for this scenario.
This is the main material, but all this is new to me.
source
share