Jump to content

[SOLVED] Count down postings remaining for user


Recommended Posts

I am trying to update the amount of postings remaining down everytime a user posts so if the user had a limit of 200 posts then when the user posts it counts down by 1 and updates the table field for that user to 199.


Now the error that I am getting is that it does not count down correctly and puts 20 instead and then the next time the user posts after that it will put 0.


$remain = mysql_query("SELECT postings_remaining FROM ".TBL_USERS." WHERE username = '$session->username' limit 1");
	$postings = $remain; //Count the number of postings remaining the user has
	$postingsremain = $postings - 1; //Remove 1 to the users posting remainings
	$sqlcountdown = mysql_query("UPDATE ".TBL_USERS." SET postings_remaining = '$postingsremain' WHERE username = '$session->username'");


If someone can help me with this function I would very much appreciate it.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.