Help with SQL Query

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Help with SQL Query

Post by igorw »

I'm trying to install the Board Statistics Mod. The problem is, that it seems a bit outdated, and the "mod_table_inst.php" won't work. I looked into the file, and it looks like this (The Query part):

Code: Select all

	if ( ($dbms == 'mysql') || ($dbms == 'mysql4') )
	{
		$data = '
CREATE TABLE phpbb_stats_config (
  config_name varchar(50) NOT NULL default \'\',
  config_value varchar(255) NOT NULL default \'\',
  PRIMARY KEY (config_name)
);

CREATE TABLE phpbb_stats_modules (
  module_id tinyint(8) NOT NULL default \'0\',
  name varchar(150) NOT NULL default \'\',
  active tinyint(1) NOT NULL default \'0\',
  installed tinyint(1) NOT NULL default \'0\',
  display_order mediumint(8) unsigned NOT NULL default \'0\',
  update_time mediumint(8) unsigned NOT NULL default \'0\',
  auth_value tinyint(2) NOT NULL default \'0\',
  module_info_cache blob,
  module_db_cache blob,
  module_result_cache blob,
  module_info_time int(10) unsigned NOT NULL default \'0\',
  module_cache_time int(10) unsigned NOT NULL default \'0\',
  PRIMARY KEY (module_id)
);

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'install_date\', \'' . time() . '\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'return_limit\', \'10\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'version\', \'2.1.5\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'modules_dir\', \'stat_modules\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'page_views\', \'0\');
';
so i tried running that manually as a query, but it wouldn't work. Can anyone help?

Thanks!

eviL<3
User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Post by Jim_UK »

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'install_date\', \'' . time() . '\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'return_limit\', \'10\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'version\', \'2.1.5\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'modules_dir\', \'stat_modules\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'page_views\', \'0\');
';


Try removing the '; at the end

Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

I tried that, but phpMyAdmin just keeps loading and loading. I used db_update generator to create a new php update file. I used this query:


Code: Select all

CREATE TABLE phpbb_stats_config (
  config_name varchar(50) NOT NULL default \'\',
  config_value varchar(255) NOT NULL default \'\',
  PRIMARY KEY (config_name)
);
And got this error, after creating the db_update.php, and running it:
CREATE TABLE phpbb_stats_config ( config_name varchar(50) NOT NULL default \'\', config_value varchar(255) NOT NULL default \'\', PRIMARY KEY (config_name) )
+++ Error: 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 '\'\', config_value varchar(255) NOT NULL default \'\', PR


Must be something like a database change in phpBB versions...

Thanks
User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Post by Jim_UK »

I have just created an install of phpBB2 on localhost and tested the file mod_table_inst.php and it created the database and inserted the values without any problems.


Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Okay, i got it to work by removing the '\'s, but i still get one small error:
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('install_date', '' . time() . '')
+++ Error: 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 '. time() . '')' at line 1


The Query is:
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('install_date', '' . time() . '');
User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Post by Jim_UK »

Please wait a moment. I will restart my servers and download a backup of the database. You can try the backup sql

Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Cool, thanks! :D
User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Post by Jim_UK »

Code: Select all

#
# Table structure for table `phpbb_stats_config`
#

DROP TABLE IF EXISTS phpbb_stats_config;
CREATE TABLE phpbb_stats_config (
  config_name varchar(50) NOT NULL default '',
  config_value varchar(255) NOT NULL default '',
  PRIMARY KEY  (config_name)
) TYPE=MyISAM;

#
# Dumping data for table `phpbb_stats_config`
#

INSERT INTO phpbb_stats_config VALUES ('install_date', '1140869473');
INSERT INTO phpbb_stats_config VALUES ('return_limit', '10');
INSERT INTO phpbb_stats_config VALUES ('version', '2.1.5');
INSERT INTO phpbb_stats_config VALUES ('modules_dir', 'stat_modules');
INSERT INTO phpbb_stats_config VALUES ('page_views', '0');
# --------------------------------------------------------

#
# Table structure for table `phpbb_stats_modules`
#

DROP TABLE IF EXISTS phpbb_stats_modules;
CREATE TABLE phpbb_stats_modules (
  module_id tinyint(8) NOT NULL default '0',
  name varchar(150) NOT NULL default '',
  active tinyint(1) NOT NULL default '0',
  installed tinyint(1) NOT NULL default '0',
  display_order mediumint(8) unsigned NOT NULL default '0',
  update_time mediumint(8) unsigned NOT NULL default '0',
  auth_value tinyint(2) NOT NULL default '0',
  module_info_cache blob,
  module_db_cache blob,
  module_result_cache blob,
  module_info_time int(10) unsigned NOT NULL default '0',
  module_cache_time int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (module_id)
) TYPE=MyISAM;
Try that
Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Wow, thanks! It worked perfectly! But now i have the problem that this mod doesn't seem to be compatible with the latest phpBB. Does anybody have a soltution for this?

Thanks! here is the thread, and here is an older version.

I'd be very thankfull if anybody could help me!

PS: I know you don't support premodded packs here, but phpBBXS has it installed: Statistics.php
User avatar
Interlog
Registered User
Posts: 1258
Joined: Sat Jun 11, 2005 4:11 pm
Location: London, UK
Contact:

Post by Interlog »

I've got it working OK. What exactly is the problem with incompatability?

Mark :D
Image
User avatar
Interlog
Registered User
Posts: 1258
Joined: Sat Jun 11, 2005 4:11 pm
Location: London, UK
Contact:

Post by Interlog »

I've got it working OK. What exactly is the problem with incompatability?

Mark :D
Image
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Have a look your self: http://www.ut4e.com/evil/forum/statistics.php

I have no idea what could be causing this...
User avatar
Interlog
Registered User
Posts: 1258
Joined: Sat Jun 11, 2005 4:11 pm
Location: London, UK
Contact:

Post by Interlog »

I presume you have installed and activated the modules in the ACP?

Mark :D
Image
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Well... That's the second (or the causing?) Problem:

Image

Image
User avatar
Interlog
Registered User
Posts: 1258
Joined: Sat Jun 11, 2005 4:11 pm
Location: London, UK
Contact:

Post by Interlog »

Do you have any Modules in the Module directory?

Mark :D
Image
Locked

Return to “[2.0.x] MOD Requests”