In this article, I'll demonstrate how to create a very simple-counter for a web (WebCounter). First of all, prepare the database - more accurately, create the necessary tables. The table name will be "counter" and will have two columns: "id" - number of records to be added and automatically zoom in for each record in a table and "address" - IP addresses of visitors. To do this, use the following SQL code (maybe you know where it is contracting): Code: SQL Code: CREATE TABLE counter (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, address VARCHAR (15)) Now let's go on to our script. Generally, the script will work like this: Verifies whether an IP address is not yet in the database (which is the case of a new visitor), or IP address we already have (which means that the visitor was already here). In the first case, add a database to record and extract the highest "id", in the second case, just dump the "id". PHP: $ Remote_ip = $ _SERVER ['REMOTE_ADDR']; / / find the IP/ / We are looking for it in the database:$ Sql_query = "SELECT * FROM counter WHERE address = '$ remote_ip'";$ Sql_res = mysql_query ($ sql_query);/ / If the first time here - not a record:if (mysql_fetch_array ($ sql_res)) {/ / Add it to DB$ Sql_query = "INSERT INTO counter (address) VALUES ('$ remote_ip')";mysql_query ($ sql_query);/ / Get the highest id$ Id = mysql_fetch_array (mysql_query ("SELECT MAX (id) FROM counter"));/ / And extract it:echo "You are visitor #". $ id ['MAX (id)'];} Else {/ / when he returns (which put to other cases) .../ / Get the highest id:$ Count = mysql_fetch_array (mysql_query ("SELECT MAX (id) FROM counter"));echo "You are visitor #". $ count ['MAX (id)'] / / and extract it} Do not forget to connect to database server (mysql_connect ('server', 'user', 'pass')), and select the database (mysql_select_db ('db_name')). Of course, this simple code can be extended to - You can add there a last visit func, or counter of the views, etc. P. S. I apologize for the terrible grammar ..., I had no time to correct it Stay tuned for the further Articles!
This is the most funny part of your article. Please don't write the wrong grammar then so you may not need to correct it. If you are very busy you may not write article in the first place because here no one forced you to write articles. Apart from that I have few more points to make. Every time you are submitting your articles in forums and not as articles. I can help you once to get the forum thread into article but you should be learning the process of writing articles. Make sure you write some thing unique to help fellow programmers and just for the sake of writing the content is not needed. Last but not the least is make sure you submit articles which needs almost no editing and your articles always need lot of them. Please make sure you submit only once you have reviewed your content.
I'm sorry Shabbir, I thought I have a lot of time, but the something had run into and I had to post it as it was ... 1st I don't know how to submit articles, my bad, i know, sorry for that too, 2nd I'll try to write about something really interesting, i swear, I'll get it up! 3rd I tried my best, I truly apologize. I will get it right next time PS: Thanks for editting my articles ...
@Scripting good first try, if you work on it or try something a bit different he might except it as an article. of course you need to post them in them here http://www.go4expert.com/forumdisplay.php?f=1
I impress after see the complete code by you. That's the nice after read your post. I's very good thing and informative for the developer point of view.