bhawap Posted October 21, 2009 Share Posted October 21, 2009 ok see rite now my sites hit counter is counted from the mysql visitor log i need to clear it after atleast 20 000 but i dont wana loose the count this is how i get the count now how do i add 20 000 to it if i clear the sql data base $SqlResult = MySqlSelect("Select * From traffic_log"); $RowCnt = mysql_numrows($SqlResult); Quote Link to comment Share on other sites More sharing options...
bhawap Posted October 21, 2009 Author Share Posted October 21, 2009 ok see rite now my sites hit counter is counted from the mysql visitor log i need to clear it after atleast 20 000 but i dont wana loose the count this is how i get the count now how do i add 20 000 to it if i clear the sql data base please help me with this Thanks in advance Zainul $SqlResult = MySqlSelect("Select * From traffic_log"); $RowCnt = mysql_numrows($SqlResult); Quote Link to comment Share on other sites More sharing options...
bhawap Posted October 21, 2009 Author Share Posted October 21, 2009 what i am saying is say the rowcnt = 20 000 it must add 20 000 to it and give a result of 40 000 i tried this $SqlResult = MySqlSelect("Select * From traffic_log"); $RowCnt = mysql_numrows($SqlResult)+20000; but it dont work Quote Link to comment Share on other sites More sharing options...
lmhart Posted October 21, 2009 Share Posted October 21, 2009 Why not just add a counter in your DB table that auto increments. When you delete all the rows you have the option to reset the counter back to 0 or keep it where it is. That way all you have to do is query what is currently in that field. Quote Link to comment Share on other sites More sharing options...
bhawap Posted October 21, 2009 Author Share Posted October 21, 2009 cant i just add to it? Quote Link to comment Share on other sites More sharing options...
lmhart Posted October 22, 2009 Share Posted October 22, 2009 well then you may need to try something like this example example $i = 0; //set this to where you want to start while($test = mysql_fetch_array($result)) { echo $test['some_field']; // list whatever 'somefield' echo "<br>"; // returns blank line $i++; // increments counter by 1 } echo $i; // outputs what the current counter value Quote Link to comment Share on other sites More sharing options...
bhawap Posted October 22, 2009 Author Share Posted October 22, 2009 this is how i do it rite now how do i add that so i can add the 20000 in it then del everything from the mysql database <?php if ($GetHitCount != "False") { $SqlResult = MySqlSelect("Select * From traffic_log"); $RowCnt = mysql_numrows($SqlResult); //counter string replace $counterstr = str_replace("0",'<img src="Images/Hit-counter/computer/0.gif" border="0" alt="" />',$RowCnt); $counterstr = str_replace("1",'<img src="Images/Hit-counter/computer/1.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("2",'<img src="Images/Hit-counter/computer/2.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("3",'<img src="Images/Hit-counter/computer/3.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("4",'<img src="Images/Hit-counter/computer/4.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("5",'<img src="Images/Hit-counter/computer/5.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("6",'<img src="Images/Hit-counter/computer/6.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("7",'<img src="Images/Hit-counter/computer/7.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("8",'<img src="Images/Hit-counter/computer/8.gif" border="0" alt="" />',$counterstr); $counterstr = str_replace("9",'<img src="Images/Hit-counter/computer/9.gif" border="0" alt="" />',$counterstr); echo' <center><font face="Verdana" size="2"><b> Visitor Number</b> </font></a></center>'."\n"; echo " <center>" . $counterstr . "</center>"; } ?> Quote Link to comment Share on other sites More sharing options...
bhawap Posted October 22, 2009 Author Share Posted October 22, 2009 and thanks in advance for all your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.