Find out how many visitors for a website


Hi;
i'd like to ask how to count how many visitor come to my website

For example;
i got a table called visitors_table, it got some attributes like visitor_ip, visitor_date,id...
and in the visitor_date 2008-11-20, there are some visitors come to my page
2008-11-20 10:00:00 58.96.75.130
2008-11-20 10:00:30 58.96.75.130
2008-11-20 10:01:30 61.135.168.39
2008-11-20 10:21:30 61.135.168.39
2008-11-20 10:21:31 67.195.37.186

then i said in the date of 20, there are 3 visitors come to my website

and in the 2008-11-21,there are some visitors come to my page
2008-11-21 10:00:00 58.96.75.130
2008-11-21 10:00:30 58.96.75.130
2008-11-21 10:01:30 61.135.168.39
2008-11-21 10:21:30 61.135.168.39
2008-11-21 10:21:31 67.195.37.200



then i said in the date of 21, there are 3 visitors come to my website

and finnaly, i said in two days of the 20 and 21, there are 6 visitors come to my website

and i use the following query, i just got 5 visitors, i could not get 6 visitors from the following query, could you tell why
SELECT count(distinct visitor_ip) FROM `visitors_table` where visitor_date>="2008-11-20"
Posted On: Monday 29th of October 2012 05:50:35 AM Total Views:  194
View Complete with Replies

RELATED TOPICS OF MYSQL PROGRAMMING LANGUAGE




How to find and show only specific words in text?

Hi , I'm still new to MySQL. I have a table and every row has a text in it like "bla vlsa ORDER slkalk LINE asd LINE sajkdska LINE slkaldka LINE saasdkj ". My goal is to find matching words like "LINE ,ORDER, SUPP,etc." and to output only these ones to an HTML table via PHP. Is it possible Cheers, M.
VIEWS ON THIS POST

119

Posted on:

Wednesday 24th October 2012
View Replies!

Search not find results

I am using the following code to search my mysql database and I know that there is a record in the database that matches the criteria but it still says it is not finding any matches why
VIEWS ON THIS POST

68

Posted on:

Wednesday 24th October 2012
View Replies!

How to find Last Hour Mysql activities

I want to find the mysql entries, that added in the last hour. mysql> SELECT something FROM tbl_name WHERE DATE(CURDATE(),INTERVAL -1 HOUR); Is this work or any other easy ways, please help me.
VIEWS ON THIS POST

72

Posted on:

Wednesday 24th October 2012
View Replies!

Invalid Use of GROUP function, cannot find an issue :(

Hi all, Written a query and MySQL has just come up with "Invalid Use Of Group Function" as the error - but it doesn't tell me where or why e.t.c I have been looking at this query and it is probably something silly, but after all this looking I cannot see the wood from the trees! If someone would point me in the right direction, it would as always be most appreciated. TIA SQL Code: Original - SQL Code SELECT ORDER_NUM, IF(COUNT(STOCK_ID)=1,COMPONENT_NAME,'Various') as 'Component Name', COUNT(STOCK_ID) as 'Items Ordered', (COUNT(STOCK_ID)-COUNT(STOCK_SN)) as 'Items Outs', SUM(STOCK_VALUE) as 'Order Value' FROM ORDERS left outer join STOCK on STOCK.ORDER_ID=ORDERS.ORDER_ID left outer join COMPONENT_LIST on STOCK.COMPONENT_ID=COMPONENT_LIST.COMPONENT_ID WHERE ORDERS.SUPPLIER_ID=".$_REQUEST['SUPPLIER_ID']." and (DATEDIFF(NOW(),DELIVERED_DATE)>{$_SESSION['SHOW_INACTIVE']} or (COUNT(STOCK_ID)-COUNT(STOCK_SN)>0)) GROUP BY ORDER_NUM ORDER BY ORDERS.SUPPLIER_ID,ORDERS.ORDER_ID, COMPONENT_LIST.COMPONENT_ID
VIEWS ON THIS POST

119

Posted on:

Wednesday 24th October 2012
View Replies!

Need help finding next entry for query

I am working on a picture site. I have a search page that will show thumbnails. If they click the thumbnail it will then send them to a viewer page which will have a bigger image of what they wanted along with the previous pic in the search and the next one. I have managed to get this to work using the (int) time value with '' the image they want and rebuilding the query. My problem is I cannot use '' with the text columns like the owner_name or the subject. I am going to post a little bit of php code in which is what is working for the time sort. Just need help working out the text sorts. PHP Code: include'db.php'; \t\t$q="selecta.pid,a.filepath,a.filename,a.hits,a.subject,a.ctime,a.owner_namefrombinpicsite.picturesasawherea.pid=$pid"; \t\techo$q; \t\t$result=mysql_query($q,$mysql)ordie(mysql_error()); \t\twhile($row=mysql_fetch_assoc($result)) \t\t{ \t\t\t\t$picinfo['original']=$row; \t\t\t\t$picinfo['display']= \t\t\t\t{$row['subject']} \t\t\t\t{$row['hits']}Views EOD; \t\t} \t\tmysql_free_result($result); \t\tswitch($sort) \t\t{ \t\t\t\tcase"drf": \t\t\t\t\t\t$order="anda.ctime\t{$picinfo['original']['ctime']}orderby`ctime`asc"; \t\t\t\t\t\tbreak; \t\t\t\tcase"dof": \t\t\t\t\t\t$order="anda.ctime>{$picinfo['original']['ctime']}orderby`ctime`asc"; \t\t\t\t\t\t$revorder="anda.ctime\t'{$picinfo['original']['subject']}'orderby`subject`desc"; \t\t\t\t\t\tbreak; \t\t\t\tcase"sof": \t\t\t\t\t\t$order="anda.subject>'{$picinfo['original']['subject']}'orderby`subject`desc"; \t\t\t\t\t\t$revorder="anda.subject\t'{$picinfo['original']['owner_name']}'orderby`owner_name`desc"; \t\t\t\t\t\tbreak; \t\t\t\tcase"pof": \t\t\t\t\t\t$order="anda.owner_name>'{$picinfo['original']['owner_name']}'orderby`owner_name`desc"; \t\t\t\t\t\t$revorder="anda.owner_name
VIEWS ON THIS POST

74

Posted on:

Wednesday 24th October 2012
View Replies!

SQL queries help-find nearby within (x) km using Lat and Lon..

I have a databse contains Lat and Lon of attractions, and like to find nearby x amount of radius in kilometers. queries would be "show me other attractions within 5km of this attraction" there are lots listing in forum about calculation between two point but could not find the SQL statement to find nearby search, dose any one know how to do this.
VIEWS ON THIS POST

189

Posted on:

Wednesday 24th October 2012
View Replies!

Query to find records based on Distance(miles) and zip code

Hi I am working on a directory where I have a search form with following two fields, 1 - Enter City Name or Zip Code 2 - Select Miles (dropdown ->5,10,15,20) A user will either submit hist city name e.g New York and distance e.g 10 Miles and on submitting form I have to pick all the records which are within 10 miles distance from City or City's zipcode.... I have two tables now, Records Table: in this table I have many columns including two 'zip code' and 'city' columns which stores zip code and FULL city name of each record respectively... Zip Code Table: in this table I have three columns 1) zip code 2) longitude 3) latitude this table is pre-populated with accurate information Basic function of the search form is that a user can enter his zip code or city name and the number of miles to see which stores exist within the given distance from his current location. I am just stuck that what kinda query I need to pick all the data in comparison with the two tables. I wonder if anyone could help
VIEWS ON THIS POST

71

Posted on:

Wednesday 24th October 2012
View Replies!

Optimize query to find what ranges of items exist

i'm trying to get a query to tell me what price ranges exist on the site, so i need a query to look at the table and tell me that there are products that are in the $0-$99, $300-$399, and $400-$499 price ranges for example, i don't care how many, just weather they exist or not so far i have this sql Code: Original - sql Code SELECT (products_price/100) & 255 as price_range FROM `products` GROUP BY price_range ORDER BY price_range ASC
VIEWS ON THIS POST

78

Posted on:

Wednesday 24th October 2012
View Replies!

find lowest unique number in a column (was "SQL query help needed")

Hi folk, Been working on a query whole day without progress so I hope someone of you experts can help me. I need to find the lowest unique number in a column: (Sorry dont know how to tag the code) (got a column name price and time) price time 5 2006-05-04:12:00:00 4 2006-05-04:12:00:04 5 2006-05-04:12:01:16 12 2006-05-04:12:02:54 4 2006-05-04:12:05:02 as you all can see is "12 2006-05-04:12:02:54" the lowest unique number. but how do I put this in a query\t
VIEWS ON THIS POST

98

Posted on:

Wednesday 24th October 2012
View Replies!

Select finding no data

I think I must have the settings for mysql wrong. I am using mysql 5 with php4 on apache on a windows xp computer. My problem is that I am creating a blog using dreamweaver. I create a recordset from a database and bind it to the page. Then, when i want to display some of the data from the record set, i do select etc and end up with something like this: SELECT blg_article_art.id_art, blg_topic_top.id_top, blg_topic_top.title_top, blg_article_art.title_art, blg_article_art.description_art, blg_article_art.date_art, blg_article_art.text_art FROM (blg_topic_top LEFT JOIN blg_article_art ON blg_article_art.idtop_art=blg_topic_top.id_top) WHERE blg_article_art.id_art=id_art ORDER BY blg_article_art.id_art ASC, blg_article_art.date_art DESC Now the url parameter (WHERE blg_article_art.id_art=id_art) has a default value of -1 but when I test the statement I get no data found. If i change the default value to 0 or a positive integer then one of the records is found but only one. I am trying to get it to display a single article from from a set of articles based on the is of the article. I have tried this with another database and get the same thing which makes me think either I have mysql set up incorrectly (although it works for all the other record sets that do not have -1) or I am very, very thick. Sorry for the length of this. Any miracles would be greatly appreciated.
VIEWS ON THIS POST

85

Posted on:

Wednesday 24th October 2012
View Replies!

Left join, find orphans, rows that won't match

hi, I know I've done this kind of stuff before, but just cannot get this working... So I need to get those "objects", that have a "location_id" of a "location" -object, that has been deleted. So looking for orphans here... Code: SELECT o.id, o.name FROM object o LEFT OUTER JOIN location l ON o.location_id = l.id
VIEWS ON THIS POST

79

Posted on:

Wednesday 24th October 2012
View Replies!

finding records which is not read by Tom the receiver.

Code: myTable7 (id) message name (1) Tom's message1 [Tom] (2) Mary's message2 which send to Tom [Mary] (3) Tom's message3 [Tom] (4) Mary's message4 which send to Tom [Mary] (5) Jack's message5 which send to Tom, and Tom already read it [Jack] (6) Tom's message6 [Tom] (7) Jane's message7 [Jane] Code: myTable8 (id) mother (3) 1 / Both (3) and 1 in myTable7 are written by Tom. (4) 2 / Both (4) and 2 in myTable7 are written by Mary. (5) 1 / (5) in myTable7 is written by Jack and 1 in myTable7 is written by Tom. This means Tom already read it because the person who wrote mother's message can read his or her kids' message (6) 1 / Both (6) and 1 in myTable7 are written by Tom. Code: myTable9 (id) name (2) [Tom] / (2) in myTable7 is written by Mary and sended to Tom. Tom didn't read it because there is no record about it in myTable8. (4) [Tom] / (4) in myTable7 is written by Jane and sended to Tom. Tom didn't read it because there is no record about it in myTable8. (5) [Tom] / (5) in myTable7 is written by Jack and sended to Tom. Tom did read it because there is a record about it in myTable8. I have 3 tables like the above. I like to find every message which is not read by Tom although it is sended to Tom. The following is my target result. Code: target result (2) Mary's message2 which send to Tom [Mary] (4) Mary's message4 which send to Tom [Mary] Both of my target record are incidentally written by Mary. Mary is not the factor of finding my target result because that is incidental of this case. But Tom is the factor of finding my target result. The following is one of my trials. Code: select myTable7.id,message,myTable7.name from myTable8 left join myTable7 on myTable8.id=myTable7.id left join myTable9 on myTable8.id=myTable9.id where myTable8.id is null and myTable9.name="Tom"
VIEWS ON THIS POST

93

Posted on:

Thursday 25th October 2012
View Replies!

Cant find some of source make files

These make files needed for add character set now i cant find it I have generic source distribution and with cmake generated and compiled but i cant see these files strings/Makefile.am libmysql/Makefile.shared am i did something wrong here is add character set in doc MySQL :: MySQL 5.5 Reference Manual :: 9.3 Adding a New Character Set i use source distribution version 5.5.11 Please answer my question
VIEWS ON THIS POST

91

Posted on:

Thursday 25th October 2012
View Replies!

LIKE %% Error: Won't find if first character

I am using a like '%%' to find an actor's name among a film's credits. It works fine, except if the actors name is first on the credits list for the film: such as Tom Hanks, Sharon Stone, Samuel L. Jackson, Renee Zellweger the like '%Samuel L. Jackson%' works just fine, but if I search like '%Tom Hanks%' it won't find the film with the credits like above. First name isn't being picked up My Mysql is 4.0 I believe. Ryan
VIEWS ON THIS POST

77

Posted on:

Thursday 25th October 2012
View Replies!

finding max date

Postgres 8.1 Using this query: PHP Code: SELECT max(tblnotes.startdate)ASmax FROM tblnotes This isn't working. It works if the field is simply a numerical field but I don't think I'm letting postgres know that it's a date field using the above query. Does anyone know how to do this
VIEWS ON THIS POST

105

Posted on:

Thursday 25th October 2012
View Replies!

Can't find file! error 13 on MySQL please help!!

. I have database and i changed the tables but during change i deleted important table!! before changed i created a copy of database by "mysqlhotcopy" command and stored it on /home/mywebsite Note: the name of backup database is "mydb_backup" Note2: i'm "root" of web server. i'd like to copy 'users' table from "mydb_backup" to "mydb_ver2". i copied this file "users" to "/var/lib/mysql/mydb_ver2" but if i'd like to showing it, the following error showing to me: Can't find file: './mydb_ver2/msgs.frm' (errno: 13) the very sadden! "users" table is very important! any idea to restore it Note: i just used mysqlhotcopy command i don't used any command after it. please dny idea thaaaaaaaanks
VIEWS ON THIS POST

183

Posted on:

Thursday 25th October 2012
View Replies!

Query to find duplicates takes too long - causing time outs

Hi all, I'm trying to run this query against a MySQL table to find duplicates. The table has about 1,200,000 records: Code: SELECT * FROM SomeTable WHERE Address IN (SELECT Address FROM SomeTable GROUP BY Address HAVING count(Address) > 1 ) ORDER BY Address The issue is that this query takes an increadibly long time. Running this query within phpMyAdmin, causes it to hang. Running this within a php script, the browser eventually times out with a 500 error. Is there a better way, or more efficient query, that could be run without taking so much time
VIEWS ON THIS POST

77

Posted on:

Monday 29th October 2012
View Replies!

SQL query to find closest x/y points in 2D

Imagine a database table: with columns: POINT, X, Y which represent points on a 2D X/Y axis. I'm trying to figure out how I can write an SQL query which will return a list of points closest in distance to point(100,105) ordered by the closest. Is it possible to do it in a SQL query
VIEWS ON THIS POST

82

Posted on:

Monday 29th October 2012
View Replies!

How do i find out the row size in kb?

how do i find out the row size in kb is it possible to automatically insert the size I have a mail table and have the field is there a way of automatically creating the value on insert by resetting the values of the field\t Code: `messagesize` int(255) NOT NULL default '0', but am unsure how to do this any ideas I have thought that maybe i have to call the last inserted ID get the value then do an update of that row but am unsure of how to do this in php.
VIEWS ON THIS POST

84

Posted on:

Monday 29th October 2012
View Replies!

How to use Full Text search to find 1000 product names in a 400K product catalog

I'm have 2 tables containing product info from 2 different sources (1 is 1000 top-selling products and the other is 400K products from various catalog). i'm trying to find the 1000 products in the 400K product catalog by using full text search to match the product names, and spit out a table containing the matches. (Product names aren't an exact match) PLEASE HELP - I don't know how to loop across the 1000 products. The full-text-search needs a CONSTANT in the AGAINST argument - how do i feed it with the product name, which is another table. The query i'm using is SELECT product_feed.*, top_products.name.* WHERE MATCH(product_feed.name) AGAINST (top_products.name) LIMIT 4 Having rel>.8; Note i'm limiting to the 4 most relevant results and am using a high relevance threshold, so that i don't get too many matches that i'll have a hard time filtering. Examples of product names are - - Unicure Generic Cialis, Tadalafil 20 Mg 90 Pill 18 Free Pill - Philips 1050CC - Omron Omron HEM 650 Wrist Blood Pressure Monitor with A.P.S - Unicure Viagra 30 Pills 100mg Each - Clarisonic Clarisonic Skin Care Brush - Braun Braun Oral B Professionalcare 9400 Triumph, D255264 - Johnson & Johnson Acuvue 2 Contact Lenses - Sonicare Sonicare Elite E9500 Electronic Toothbrush
VIEWS ON THIS POST

90

Posted on:

Monday 29th October 2012
View Replies!