Hi guys, I have a rather simple issue. I have a SMALLINT column, and I want this value to rise by one each-time I use that row (Basically this is recording the number of views on that row).
At the moment I am doing this (Stripped-down for the example):
This seems like something might exists that can do this within MySQL. So, my questions would be..PHP Code:
// After selecting the row I want, with an associative array.
$new_value = ++$result['views']; // Increment with php, and call an UPDATE..
$mysqli->query("UPDATE table_name SET views = $new_value WHERE row_id = $variable");
1. Is there a way to increment an existing column without specifically calling UPDATE on it?
2. Is there a way to increment it with SQL, so I can just do this in the query?