Jump to content

Mysql Counter Problem, it goes up in 2's!


teammist

Recommended Posts

 mysql_connect("localhost", "lala", "password") or die(mysql_error());
 mysql_select_db("blah") or die(mysql_error());

//Adds one to the counter
 mysql_query("UPDATE counter SET counter = counter + 1");


 $count = mysql_fetch_row(mysql_query("SELECT counter FROM counter"));

 

 

why does it go up in 2s?

Link to comment
Share on other sites

well. Its this image. http://teammist.biz/image.php

 

Not giving the code because i worked hard on it. It requests a few things, but yet, i tried it with a text file:

 

$File = "counter.txt";
 //This is the text file we keep our count in, that we just made
 
 $handle = fopen($File, 'r+') ;
 //Here we set the file, and the permissions to read plus write
 
 $data = fread($handle, 512) ;
 //Actully get the count from the file
 
 $count = $data + 1;
 //Add the new visitor to the count
 
 
 fseek($handle, 0) ;
 //Puts the pointer back to the begining of the file
 
 fwrite($handle, $count) ;
 //saves the new count to the file
 
 fclose($handle) ;
 //closes the file

 

And had no problems.

Link to comment
Share on other sites

Not giving the code because i worked hard on it. It requests a few things, but yet, i tried it with a text file:

 

Really? I could write code to dynamically create an image with the same data in about 30 min. And, you work hard on something that you don't want to share, but expect US to take time out of our lives to help you for free. Interesting.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.