Joshua F Posted June 29, 2010 Share Posted June 29, 2010 Hello, I am trying to make a little referal system that add's +1 to when someone visits the referal. I would like to know how I can make the database add +1. Would it be something like this? mysql_query("UPDATE ref add ip= +1); I don't think it would be that, but anyone got any ideas? Link to comment https://forums.phpfreaks.com/topic/206149-1-to-database/ Share on other sites More sharing options...
trq Posted June 29, 2010 Share Posted June 29, 2010 UPDATE tbl SET fld = fld+1 WHERE ip = '10.1.1.1' Link to comment https://forums.phpfreaks.com/topic/206149-1-to-database/#findComment-1078591 Share on other sites More sharing options...
Joshua F Posted June 29, 2010 Author Share Posted June 29, 2010 UPDATE tbl SET fld = fld+1 WHERE ip = '10.1.1.1' Actually I forgot to remove the IP thing, so would it be this? UPDATE ref SET ref = ref+1 If the table and database are both named "ref"? Edit: Nvm it is, thanks for the help Link to comment https://forums.phpfreaks.com/topic/206149-1-to-database/#findComment-1078594 Share on other sites More sharing options...
Mchl Posted June 29, 2010 Share Posted June 29, 2010 Except it increases ref column in entire table. Link to comment https://forums.phpfreaks.com/topic/206149-1-to-database/#findComment-1078597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.