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? Quote 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' Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/206149-1-to-database/#findComment-1078597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.