insert or update / and ignore
Hello.
let's say i want to add a row to a table called "todaypics" with this 3 columns:
| picnum | imagename | todayhits |
and i do this:
PHP Code:
mysql_query("INSERT INTO todaypics (picnum, imagename, todayhits) VALUES('72', 'somepicturename.jpg', '35') ")
or die(mysql_error());
the data is inserted
| 72 | somepicturename.jpg | 35 |
witn no problem.
but if the row was already on the
tablewith this data:...
| 72 | somepicturename.jpg | 34 |
...how sohuld be the query to avoid the duplicate error and update the column "todayhits" value to 35??