Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Phoca Gallery - image gallery extension
AndreaNobili
Phoca Member
Phoca Member
Posts: 14
Joined: 06 Oct 2009, 18:40

Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by AndreaNobili »

Hello,
I have a big problem about the installation of Phoca Gallery 2.6.1 on my Joomla site.

The problem is that after installing Phoca Gallery if I enter in "Categories" section I have this warning message:
Warning: Invalid argument supplied for foreach() in /web/htdocs/www.siatec.net/home/andrea/andreanobili ... lerycs.php on line 126

If I try to create a new category it is not show in the category list of the "categories" section of Phoca Gallery but apears in the ANP_phocagallery_categories tables of mya database as a new record and it is very strange.

In the past (with the old version of Phoca Galery) I had the problem showed here: https://www.phoca.cz/documents/2-phoca-g ... em-solving and I solved with this solution but now I think that this is a different kind of problem because I have the table in my database and because this time the warning message is different...

What can I do to solve?

Please help me, it's very important for me :-(

Tanks
Andrea Nobili
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by Jan »

Hi, did you check all tables and columns in your database (phpMyAdmin) with the install.bak file?
If you find Phoca extensions useful, please support the project
ASoraru
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 06 Jul 2009, 17:27

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by ASoraru »

Jan wrote:Hi, did you check all tables and columns in your database (phpMyAdmin) with the install.bak file?
Hi Jan,

how can i check this ? ... i really dont know what to do ...

Regards,

Andreas
ASoraru
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 06 Jul 2009, 17:27

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by ASoraru »

ASoraru wrote:
Jan wrote:Hi, did you check all tables and columns in your database (phpMyAdmin) with the install.bak file?
Hi Jan,

how can i check this ? ... i really dont know what to do ...

Regards,

Andreas

HI there,

i did it on my own .... less difficult as i thought ... thanks for the tipp ...

Regards,

Andreas
AndreaNobili
Phoca Member
Phoca Member
Posts: 14
Joined: 06 Oct 2009, 18:40

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by AndreaNobili »

Jan wrote:Hi, did you check all tables and columns in your database (phpMyAdmin) with the install.bak file?
mmm, exactly what I have to check? if in my database there is the same table with the same column that are in the creator table query of the install.bak file?

exactly what are the tables that I need in my database?
Examining the install.back file I think thata the table that I need are:

__Phocagallery
__Phocagallery_categories
__Phocagallery_votes
__Phocagallery_comments
__Phocagallery_votes_statistics

Then I have doubts about some other tables because I do not know if there are differences between those of version 2.5 and 2.6.

This is the content of install.bak file, please can you say me what

Code: Select all

DROP TABLE IF EXISTS `#__phocagallery`;
CREATE TABLE `#__phocagallery` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `catid` int(11) NOT NULL default '0',
  `sid` int(11) NOT NULL default '0',
  `title` varchar(250) NOT NULL default '',
  `alias` varchar(255) NOT NULL default '',
  `filename` varchar(250) NOT NULL default '',
  `description` text,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `hits` int(11) NOT NULL default '0',
  `latitude` varchar(20) NOT NULL default '',
  `longitude` varchar(20) NOT NULL default '',
  `zoom` int(3) NOT NULL default '0',
  `geotitle` varchar(255) NOT NULL default '',
  `videocode` text,
  `vmproductid` int(11) NOT NULL default '0',
  `imgorigsize` int(11) NOT NULL default '0',
  `published` tinyint(1) NOT NULL default '0',
  `approved` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  `extlink1` text,
  `extlink2` text,
  `extid` varchar(255) NOT NULL default '',
  `extl` varchar(255) NOT NULL default '',
  `extm` varchar(255) NOT NULL default '',
  `exts` varchar(255) NOT NULL default '',
  `exto` varchar(255) NOT NULL default '',
  `extw` varchar(255) NOT NULL default '',
  `exth` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `catid` (`catid`,`published`)
) TYPE=MyISAM CHARACTER SET `utf8`;

DROP TABLE IF EXISTS `#__phocagallery_categories`;
CREATE TABLE `#__phocagallery_categories` (
  `id` int(11) NOT NULL auto_increment,
  `parent_id` int(11) NOT NULL default 0,
  `owner_id` int(11) NOT NULL default 0,
  `title` varchar(255) NOT NULL default '',
  `name` varchar(255) NOT NULL default '',
  `alias` varchar(255) NOT NULL default '',
  `image` varchar(255) NOT NULL default '',
  `section` varchar(50) NOT NULL default '',
  `image_position` varchar(30) NOT NULL default '',
  `description` text,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `published` tinyint(1) NOT NULL default '0',
  `approved` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `editor` varchar(50) default NULL,
  `ordering` int(11) NOT NULL default '0',
  `access` tinyint(3) unsigned NOT NULL default '0',
  `hits` int(11) NOT NULL default '0',
  `count` int(11) NOT NULL default '0',
  `accessuserid` text,
  `uploaduserid` text,
  `deleteuserid` text,
  `userfolder` text,
  `latitude` varchar(20) NOT NULL default '',
  `longitude` varchar(20) NOT NULL default '',
  `zoom` int(3) NOT NULL default '0',
  `geotitle` varchar(255) NOT NULL default '',
  `params` text,
  `extid` varchar(255) NOT NULL default '',
  `exta` varchar(255) NOT NULL default '',
  `extu` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `cat_idx` (`section`,`published`,`access`),
  KEY `idx_access` (`access`),
  KEY `idx_checkout` (`checked_out`)
) TYPE=MyISAM CHARACTER SET `utf8`;


DROP TABLE IF EXISTS `#__phocagallery_votes`;
CREATE TABLE `#__phocagallery_votes` (
  `id` int(11) NOT NULL auto_increment,
  `catid` int(11) NOT NULL default 0,
  `userid` int(11) NOT NULL default 0,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `rating` tinyint(1) NOT NULL default '0',
  `published` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `#__phocagallery_comments`;
CREATE TABLE `#__phocagallery_comments` (
  `id` int(11) NOT NULL auto_increment,
  `catid` int(11) NOT NULL default 0,
  `userid` int(11) NOT NULL default 0,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `title` varchar(255) NOT NULL default '',
  `comment` text,
  `published` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `#__phocagallery_votes_statistics`;
CREATE TABLE `#__phocagallery_votes_statistics` (
  `id` int(11) NOT NULL auto_increment,
  `catid` int(11) NOT NULL default 0,
  `count` tinyint(11) NOT NULL default '0',
  `average` float(8,6) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

-- removed in 2.6.0
-- DROP TABLE IF EXISTS `#__phocagallery_user_category`;
-- CREATE TABLE `#__phocagallery_user_category` (
--  `id` int(11) NOT NULL auto_increment,
--  `catid` int(11) NOT NULL default 0,
--  `userid` int(11) NOT NULL default 0,
--  PRIMARY KEY  (`id`),
--  KEY `catid` (`catid`,`userid`)
-- ) TYPE=MyISAM DEFAULT CHARSET=utf8;

-- version 2.5
DROP TABLE IF EXISTS `#__phocagallery_img_votes`;
CREATE TABLE `#__phocagallery_img_votes` (
  `id` int(11) NOT NULL auto_increment,
  `imgid` int(11) NOT NULL default 0,
  `userid` int(11) NOT NULL default 0,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `rating` tinyint(1) NOT NULL default '0',
  `published` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `#__phocagallery_img_votes_statistics`;
CREATE TABLE `#__phocagallery_img_votes_statistics` (
  `id` int(11) NOT NULL auto_increment,
  `imgid` int(11) NOT NULL default 0,
  `count` tinyint(11) NOT NULL default '0',
  `average` float(8,6) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

-- version 2.6.0
DROP TABLE IF EXISTS `#__phocagallery_user`;
CREATE TABLE `#__phocagallery_user` (
 `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default 0,
  `avatar` varchar(40) NOT NULL default '',
  `published` tinyint(1) NOT NULL default '0',
  `approved` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  PRIMARY KEY  (`id`),
  KEY `userid` (`userid`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `#__phocagallery_img_comments`;
CREATE TABLE `#__phocagallery_img_comments` (
  `id` int(11) NOT NULL auto_increment,
  `imgid` int(11) NOT NULL default 0,
  `userid` int(11) NOT NULL default 0,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `title` varchar(255) NOT NULL default '',
  `comment` text,
  `published` tinyint(1) NOT NULL default '0',
  `checked_out` int(11) unsigned NOT NULL default '0',
  `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL default '0',
  `params` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;
Frome here can you tell me what are the queries that I have to run in phpMyAdmin to create the tables needed by the version 2.6? Please..

Thank you very much
Andrea Nobili
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by Jan »

Hi, you can see the needed queries in the install.bak file. The file you have listed here contains all needed sql queries.

So e.g.

you will see your database e.g. table phocagallery, and you will check if your table includes all columns like there are in the sql queries, e.g.

e.g. your table includes id, catid, sid ...

in install.bak files:
`id` int(11) unsigned NOT NULL auto_increment,
`catid` int(11) NOT NULL default '0',
`sid` int(11) NOT NULL default '0', ...

you will see that the colums are ok, so you don't need run the sql of this table.
If you find Phoca extensions useful, please support the project
AndreaNobili
Phoca Member
Phoca Member
Posts: 14
Joined: 06 Oct 2009, 18:40

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by AndreaNobili »

Ok...I have cheked for the tables and for the fields in the tables and I have don't find error...so...whrere is the problem?
Do you have some idea to solve this kind of problem? Why I have this warning message? And why the category list is not showed in category section also if category is created in database? And why when I creat a new category I cant' lynk a path where put my photo? (I clik on the button but do nothing)

The warning message is this one:
Warning: Invalid argument supplied for foreach() in /web/htdocs/www.siatec.net/home/andrea/andreanobili ... lerycs.php on line 126

and it is refered ad this function that I think show the category list:

Code: Select all

/*
	 * Create category tree
	 */
	function _categoryTree( $data, $tree, $id = 0, $text='', $currentId) {		

		// Ordering
		$countItemsInCat 	= 0;
		foreach ($data as $key) {	
			$show_text =  $text . $key->title;
			
			static $iCT = 0;// All displayed items
	
			if ($key->parent_id == $id && $currentId != $id && $currentId != $key->id ) {	

				
				
				$tree[$iCT] 					= new JObject();
				
				// Ordering MUST be solved here
				if ($countItemsInCat > 0) {
					$tree[$iCT]->orderup				= 1;
				} else {
					$tree[$iCT]->orderup 				= 0;
				}
				
				if ($countItemsInCat < ($key->countid - 1)) {
					$tree[$iCT]->orderdown 				= 1;
				} else {
					$tree[$iCT]->orderdown 				= 0;
				}
				
				
				$tree[$iCT]->id 				= $key->id;
				$tree[$iCT]->title 				= $show_text;
				$tree[$iCT]->title_self 		= $key->title;
				$tree[$iCT]->parent_id			= $key->parent_id;
				$tree[$iCT]->owner_id			= $key->owner_id;
				$tree[$iCT]->name				= $key->name;
				$tree[$iCT]->alias				= $key->alias;
				$tree[$iCT]->image				= $key->image;
				$tree[$iCT]->section			= $key->section;
				$tree[$iCT]->image_position		= $key->image_position;
				$tree[$iCT]->description		= $key->description;
				$tree[$iCT]->published			= $key->published;
				$tree[$iCT]->editor				= $key->editor;
				$tree[$iCT]->ordering			= $key->ordering;
				$tree[$iCT]->access				= $key->access;
				$tree[$iCT]->count				= $key->count;
				$tree[$iCT]->params				= $key->params;
				$tree[$iCT]->checked_out		= $key->checked_out;
				$tree[$iCT]->groupname			= $key->groupname;
				$tree[$iCT]->usercatname		= $key->usercatname;
				$tree[$iCT]->parentname			= $key->parentname;
				$tree[$iCT]->hits				= $key->hits;
				$tree[$iCT]->ratingavg			= $key->ratingavg;
				$tree[$iCT]->accessuserid		= $key->accessuserid;
				$tree[$iCT]->uploaduserid		= $key->uploaduserid;
				$tree[$iCT]->deleteuserid		= $key->deleteuserid;
				$tree[$iCT]->userfolder			= $key->userfolder;
				$tree[$iCT]->latitude			= $key->latitude;
				$tree[$iCT]->longitude			= $key->longitude;
				$tree[$iCT]->zoom				= $key->zoom;
				$tree[$iCT]->geotitle			= $key->geotitle;
				$tree[$iCT]->approved			= $key->approved;
				$tree[$iCT]->link				= '';
				$tree[$iCT]->filename			= '';// Will be added in View (after items will be reduced)
				$tree[$iCT]->linkthumbnailpath	= '';

				$iCT++;
				
				$tree = $this->_categoryTree($data, $tree, $key->id, $show_text . " &raquo; ", $currentId );
				$countItemsInCat++;
			}	
		}
		
		return($tree);
	}
I think that there is some bug...I noticed that some user have this kind of proble...please can you help me? So I will post a solution in the italian Joomla network

Thanks
Andrea Nobili
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by Jan »

Did you try to enable debug mode in global configuration of Joomla! It can display wrong sql in case the data will be not loaded (which is this case). Mostly from the query you can check then if all query columns are in database tables.

Jan
If you find Phoca extensions useful, please support the project
AndreaNobili
Phoca Member
Phoca Member
Posts: 14
Joined: 06 Oct 2009, 18:40

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by AndreaNobili »

mmm I have change web hoster and now seem work well

Enabling debug mode on the Joomla on the hold web hoster the error is it:

Code: Select all

JDatabaseMySQL::query: 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 'SELECT c.parent_id, count(*) AS countid FROM ANP_phocagallery_c SQL=SELECT a.*, cc.title AS parentname, u.name AS editor, g.name AS groupname, v.average AS ratingavg, ua.username AS usercatname, c.countid AS countid FROM ANP_phocagallery_categories AS a LEFT JOIN ANP_users AS u ON u.id = a.checked_out LEFT JOIN ANP_groups AS g ON g.id = a.access LEFT JOIN ANP_phocagallery_categories AS cc ON cc.id = a.parent_id LEFT JOIN ANP_phocagallery_votes_statistics AS v ON v.catid = a.id LEFT JOIN ANP_users AS ua ON ua.id = a.owner_id JOIN (SELECT c.parent_id, count(*) AS countid FROM ANP_phocagallery_categories AS c GROUP BY c.parent_id ) AS c ON a.parent_id = c.parent_id ORDER BY a.ordering
I don't undestand why it is wrong...
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Some problem installing Phoca Gallery 2.6.1 onmy Joomla hepl

Post by Jan »

Hi, this could be displayed, if there is missing some column in table or in case you are running obsolete database (some obsolete database have problems with count)

Jan
If you find Phoca extensions useful, please support the project
Post Reply