loony383 Posted August 9, 2007 Share Posted August 9, 2007 Hi i want my code to add 1 to postcount of the user when they make a post on my forum but i dont know how to do this, here is my code can someone please tell me how to do the update thing to add 1 to the users postcount $insertpost="INSERT INTO forumtutorial_posts(author,title,post,showtime,realtime,lastposter,forumid) values('$name','$subject','$yourpost','$displaytime','$thedate','$name','$forumid')"; mysql_query($insertpost) or die("Could not insert post"); //insert post mysql_query(*UPDATE users set 'postcound'=$postcount [$postcount=1]) print "Message posted, go back to <A href='index.php?forumid=$forumid'>Forum</a>."; } thats the part of my code where i want it to update the postcount Link to comment https://forums.phpfreaks.com/topic/63991-updating-a-table/ Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 maybe mysql_query(UPDATE users set postcound= postcound+1) //sure you dont have a where clause? Link to comment https://forums.phpfreaks.com/topic/63991-updating-a-table/#findComment-318979 Share on other sites More sharing options...
loony383 Posted August 9, 2007 Author Share Posted August 9, 2007 Parse error: syntax error, unexpected T_STRING in /home2/airserve/public_html/airboard/post.php on line 82 didn't work, i thought it had to have the math stuff like operators in the line but i don't understand about doing stuff within a bit of code like just putting a operator Link to comment https://forums.phpfreaks.com/topic/63991-updating-a-table/#findComment-318983 Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 that is a syntax error not sql try to put "" around it Link to comment https://forums.phpfreaks.com/topic/63991-updating-a-table/#findComment-318984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.