[solved] Invalid argument in phocagallery.php on line 618

Phoca Gallery - image gallery extension
sulpheraas
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 08 Jan 2009, 14:21
Contact:

[solved] Invalid argument in phocagallery.php on line 618

Post by sulpheraas »

Hello!

I just been installed latest Phoca Gallery component and got error in frontend:
Warning: Invalid argument supplied for foreach() in x:\home\test1.ru\www\components\com_phocagallery\helpers\phocagallery.php on line 618
Here is the code (foreach ($data as $key) is 618 line):

Code: Select all

    // Create tree of categories and subcategories - we need strings e.g. (first, first >> second, ...)
    // text is name because of select
    // value is id because of select
    function CategoryTree($data, $tree, $id=0, $text='') {        
        
        foreach ($data as $key)
        {    
            $show_text =  $text . $key->text;    
            if ($key->parentid == $id)
            {    
And this one in admin backend:
Warning: Invalid argument supplied for foreach() in x:\home\test1.ru\www\administrator\components\com_phocagallery\helpers\phocagallery.php on line 1248

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in x:\home\test1.ru\www\libraries\joomla\database\database\mysql.php on line 342

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in x:\home\test1.ru\www\libraries\joomla\database\database\mysql.php on line 342
Usage of the gallery impossible. A pity...
Here is the example on my demo polygon.
Any ideas?

System features:
Joomla 1.5.8 (legacy mode)
JoomFish 2.0 Stable (three languages are in use)
Database Version: 5.0.32-Debian_7etch6-log
Database Collation: utf8_general_ci
PHP Version: 5.2.0-8+etch13
Web Server: Apache/1.3.34 (Debian)
Last edited by sulpheraas on 10 Jan 2009, 11:35, edited 1 time in total.
cre:active lab - web-design with Joomla!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warning: Invalid argument in phocagallery.php on line 618

Post by Jan »

Hi, it seems like the tables were not installed on your site, see the database e.g. with help of phpMyAdmin to get info about tables in your site, see:

https://www.phoca.cz/documents/2-phoca-g ... stallation
If you find Phoca extensions useful, please support the project
sulpheraas
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 08 Jan 2009, 14:21
Contact:

Re: Warning: Invalid argument in phocagallery.php on line 618

Post by sulpheraas »

Well, thanks for your reply, Jan. But I really don't understand the matter of error since it was clean installation, not upgrading and all had to be okay. So, I removed all phoca tables and ran next query:
DROP TABLE IF EXISTS `jos_phocagallery`;

CREATE TABLE `jos_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 NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`hits` int(11) NOT NULL default '0',
`published` 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 NOT NULL,
PRIMARY KEY (`id`),
KEY `catid` (`catid`,`published`)
) TYPE=MyISAM CHARACTER SET `utf8`;


DROP TABLE IF EXISTS `jos_phocagallery_categories`;

CREATE TABLE `jos_phocagallery_categories` (
`id` int(11) NOT NULL auto_increment,
`parent_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 NOT NULL,
`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',
`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',
`params` text NOT NULL,
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 `jos_phocagallery_votes`;
CREATE TABLE `jos_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 NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `jos_phocagallery_comments`;
CREATE TABLE `jos_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 NOT NULL,
`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 NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `jos_phocagallery_votes_statistics`;
CREATE TABLE `jos_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;


DROP TABLE IF EXISTS `jos_phocagallery_user_category`;
CREATE TABLE `jos_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;


# ALTER TABLE `jos_phocagallery_categories` ADD `hits` INT( 11 ) NOT NULL DEFAULT '0' AFTER `count` ;
But it makes no sense. The problem is still exist despite of instruction I followed here: Errors in installation - Manual Installation of MySQL database.
What I made wrong?

P.S. Would be nice to add [spoiler] tag into phpBB forum if such tag is supported here.
cre:active lab - web-design with Joomla!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warning: Invalid argument in phocagallery.php on line 618

Post by Jan »

Try to enable debug in global configuration, maybe you get some sql error messages...

jan
If you find Phoca extensions useful, please support the project
sulpheraas
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 08 Jan 2009, 14:21
Contact:

Re: Warning: Invalid argument in phocagallery.php on line 618

Post by sulpheraas »

Jan, thanks for your advice! I found error. jos_phocagallery_categories doesn't exist.

Gosh, it was my mistake. I removed phocagallery tables and forgot to make mentioned above query. :)

Problem is solved.
cre:active lab - web-design with Joomla!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [solved] Invalid argument in phocagallery.php on line 618

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
nmavro
Phoca Member
Phoca Member
Posts: 16
Joined: 25 Sep 2010, 11:23

Re: [solved] Invalid argument in phocagallery.php on line 61

Post by nmavro »

I have to bring this subject up again. I have that problem only with the plugin. I use the button plug in to enter code in my editor. I get this error.
Component works fine, tables are in place. Phoca plugin is enabled
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [solved] Invalid argument in phocagallery.php on line 61

Post by Jan »

Do you get some more specific error message in case you are enabling debug mode?

Jan
If you find Phoca extensions useful, please support the project
nmavro
Phoca Member
Phoca Member
Posts: 16
Joined: 25 Sep 2010, 11:23

Re: [solved] Invalid argument in phocagallery.php on line 61

Post by nmavro »

I changed some options and now it displays the image. The problem with the plugin now is that it does not work correctly unless i create a menu. I only want to display 2 photos in an article i dont want to create a new menu for them
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [solved] Invalid argument in phocagallery.php on line 61

Post by Jan »

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