Wildhalf Posted January 29, 2007 Share Posted January 29, 2007 Hi All,I am just finishing developing another site. What i want to do is return the value from a field called referrals which is an integer, add one to it and write it back to the database. Could anyone help me??? Link to comment https://forums.phpfreaks.com/topic/36131-returning-integers-from-a-mysql-database/ Share on other sites More sharing options...
Tandem Posted January 29, 2007 Share Posted January 29, 2007 Rather than draw it from the database and add 1 to it and then put it back, just update it like this:[code]mysql_query("UPDATE TABLE SET REFERRALS=REFERRALS+1 WHERE SOMETHING='something'");[/code]You can do this as long as you have set the field type to an integer value of some sort. Link to comment https://forums.phpfreaks.com/topic/36131-returning-integers-from-a-mysql-database/#findComment-171568 Share on other sites More sharing options...
Wildhalf Posted January 29, 2007 Author Share Posted January 29, 2007 Tandem,Thank you for such a quick reply. It works like a charm...Been looking on the web for 40 mins and new there would be an easy way to do it..One step closer to completion. When im finished ill PM my site to you for a look...Thanks again,Kieron Link to comment https://forums.phpfreaks.com/topic/36131-returning-integers-from-a-mysql-database/#findComment-171569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.