Ell20 Posted April 6, 2008 Share Posted April 6, 2008 Hey, Is it possible to update a table like this: $update2 = "UPDATE models SET referals='referals + 1' WHERE user_id='$userid'" or die(mysql_error()); mysql_query($update2) or die(mysql_error()); Or do I have to query to find the current value then do current value + 1 then use that new variable? Cheers Link to comment https://forums.phpfreaks.com/topic/99808-solved-just-checking-simple-question/ Share on other sites More sharing options...
papaface Posted April 6, 2008 Share Posted April 6, 2008 You can do that but do: $update2 = "UPDATE models SET referals=referals + 1 WHERE user_id= '$userid'"; mysql_query($update2) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/99808-solved-just-checking-simple-question/#findComment-510453 Share on other sites More sharing options...
Ell20 Posted April 6, 2008 Author Share Posted April 6, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/99808-solved-just-checking-simple-question/#findComment-510454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.