Page 1 of 1

who's online php help

Posted: Wed 05 Feb 2014 6:58 am
by Michael_Wright
hi I am tyring to setup who's online but getting this error code can someone help me please mike

Code: Select all

Error

SQL query: 

CREATE TABLE `whos_online` ( `session_id` varchar(128) NOT NULL default '', `ip_address` varchar(20) NOT NULL default '', `name` varchar(64) NOT NULL default '', `nickname` varchar(20) default NULL, `country_name` varchar(50) default NULL, `country_code` char(2) default NULL, `city_name` varchar(50) default NULL, `state_name` varchar(50) default NULL, `state_code` char(2) default NULL, `latitude` decimal(10,4) default '0.0000', `longitude` decimal(10,4) default '0.0000', `last_page_url` text NOT NULL, `http_referer` varchar(255) default NULL, `user_agent` varchar(255) NOT NULL default '', `hostname` varchar(255) default NULL, `provider` varchar(255) default NULL, `time_entry` int(10) unsigned NOT NULL default '0', `time_last_click` int(10) unsigned NOT NULL default '0', `num_visits` int(10) unsigned NOT NULL default '0', P[...] 

MySQL said: Documentation 
 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM DEFAULT CHARSET=utf8' at line 23 

Re: who's online php help

Posted: Wed 05 Feb 2014 12:44 pm
by SpaceWalker
If you are trying to setup the 'Who's Online PHP Script' designed by Mike Challis?

Well, as you might have seen, the script has not been updated since September 2009 and a lot of Internet things have changed since then, such as PHP and MySQL (two important components of the script). Unless you are quite familiar (almost an expert) with PHP and MySQL and you have a lot of free time (the script need a complete rewrite to make it compatible with both PHP and MySQL), I would strongly suggest that you look for something else - after spending hours and hours trying to modify the script to make it more up-to-date, I simply had to give up...

Re: who's online php help

Posted: Wed 05 Feb 2014 2:01 pm
by Karv
The create table info is in a text file, and works ok for me directly in MySQL.

Code: Select all

CREATE TABLE `whos_online` (
  `session_id`      varchar(128) NOT NULL default '',
  `ip_address`      varchar(20) NOT NULL default '',
  `name`            varchar(64) NOT NULL default '', 
  `nickname`        varchar(20) default NULL,
  `country_name`    varchar(50) default NULL,
  `country_code`    char(2) default NULL,
  `city_name`       varchar(50) default NULL,
  `state_name`      varchar(50) default NULL,
  `state_code`      char(2) default NULL, 
  `latitude`        decimal(10,4) default '0.0000',
  `longitude`       decimal(10,4) default '0.0000',  
  `last_page_url`   text NOT NULL,
  `http_referer`    varchar(255) default NULL,
  `user_agent`      varchar(255) NOT NULL default '',
  `hostname`        varchar(255) default NULL,
  `provider`        varchar(255) default NULL, 
  `time_entry`      int(10) unsigned NOT NULL default '0',
  `time_last_click` int(10) unsigned NOT NULL default '0',
  `num_visits`      int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`session_id`),
  KEY `nickname_time_last_click` (`nickname`,`time_last_click`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

Code: Select all

Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------------------------------+
| Level   | Code | Message                                                                  |
+---------+------+--------------------------------------------------------------------------+
| Warning | 1287 | 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead |
+---------+------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

Re: who's online php help

Posted: Fri 07 Feb 2014 10:16 am
by Michael_Wright
Hi Karv wanted make sure if I am doing this right I am using MYphpadmin inclosed a small picture of the database mike
Karv wrote:The create table info is in a text file, and works ok for me directly in MySQL.

Code: Select all

CREATE TABLE `whos_online` (
  `session_id`      varchar(128) NOT NULL default '',
  `ip_address`      varchar(20) NOT NULL default '',
  `name`            varchar(64) NOT NULL default '', 
  `nickname`        varchar(20) default NULL,
  `country_name`    varchar(50) default NULL,
  `country_code`    char(2) default NULL,
  `city_name`       varchar(50) default NULL,
  `state_name`      varchar(50) default NULL,
  `state_code`      char(2) default NULL, 
  `latitude`        decimal(10,4) default '0.0000',
  `longitude`       decimal(10,4) default '0.0000',  
  `last_page_url`   text NOT NULL,
  `http_referer`    varchar(255) default NULL,
  `user_agent`      varchar(255) NOT NULL default '',
  `hostname`        varchar(255) default NULL,
  `provider`        varchar(255) default NULL, 
  `time_entry`      int(10) unsigned NOT NULL default '0',
  `time_last_click` int(10) unsigned NOT NULL default '0',
  `num_visits`      int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`session_id`),
  KEY `nickname_time_last_click` (`nickname`,`time_last_click`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

Code: Select all

Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------------------------------+
| Level   | Code | Message                                                                  |
+---------+------+--------------------------------------------------------------------------+
| Warning | 1287 | 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead |
+---------+------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

Re: who's online php help

Posted: Fri 07 Feb 2014 2:00 pm
by Karv
Hi Mike,
I don't use phpMyAdmin - but it looks as though you have to with your host.

Provided for every field you select the correct corresponding data type and length etc, the table should create correctly.

It would probably be easier to go to the import tab and import the file with all the create database info and "run" it.

K

Re: who's online php help

Posted: Sat 08 Feb 2014 11:53 pm
by Michael_Wright
ok so if I use import what file do I need to upload

Re: who's online php help

Posted: Sun 09 Feb 2014 10:39 am
by Karv
i'd go with the whos-online.sql.txt file in the readme-files directory.