nouse4one Posted August 14, 2010 Share Posted August 14, 2010 Thank god 12 days straight working on this thing! Now i need a hit counter to count every time some one submits a email to one of my users. Each user on my site has a profile with there personal info stored in my db, which is called by a user_id. On each of there profile's they have a survey. After some one fills out there survey and clicks submit i want it to add a +1 to there db info so they can keep track of how many peeps fill out there dating application. check out a live example here screencupid.com/60 do i use fwrite functions with a text file? Can i store the numbers in my db? Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 14, 2010 Share Posted August 14, 2010 You would be better off just recording each set of submitted data in a database table. You can then access any of that information and get a count any time you want. Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099263 Share on other sites More sharing options...
nouse4one Posted August 14, 2010 Author Share Posted August 14, 2010 Yes that is exactly what i need help with. Can you help explain record number adding from form submissions? or perhaps point me in the right direction? Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099264 Share on other sites More sharing options...
PFMaBiSmAd Posted August 14, 2010 Share Posted August 14, 2010 Actually, I mean insert a row for each response, not add to a counter. Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099265 Share on other sites More sharing options...
Rifts Posted August 14, 2010 Share Posted August 14, 2010 I think it would be possible if you added a new field to your table like "counter" and then in your survey execute script have it pull the number from the db and add 1 to it and then UPDATE the new number back in. Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099267 Share on other sites More sharing options...
nouse4one Posted August 14, 2010 Author Share Posted August 14, 2010 ?????? <?php require_once('appvars.php'); require_once('connectvars.php'); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query = "SELECT sub_count FROM my_user WHERE user_id = '" . $_POST['user_id'];. "'"; $sub_count = ('user_id', $row['user_id'], $row['sub_count'] + (1)); mysqli_close($dbc); ?> how do i use the update function? Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099274 Share on other sites More sharing options...
Skewled Posted August 14, 2010 Share Posted August 14, 2010 Like this: $query = "UPDATE tablename SET rowvalue=rowvalue+1 WHERE something = something"; mysqli_query($dbc, $query); It will update rowvalue + 1 each time the query is executed. Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099289 Share on other sites More sharing options...
Rifts Posted August 15, 2010 Share Posted August 15, 2010 prefect! hope it helped! Link to comment https://forums.phpfreaks.com/topic/210726-i-finaly-got-it-up-my-site-need-help-with-a-hit-counter/#findComment-1099408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.