Error: Warning: mysql_num_rows() expects parameter 1 to be r

Phoca Gallery - image gallery extension
christine
Phoca Hero
Phoca Hero
Posts: 2886
Joined: 28 Nov 2010, 17:20

Error: Warning: mysql_num_rows() expects parameter 1 to be r

Post by christine »

Good afternoon,

I wanted to test something on phocagallery, so I copied some photos to my test-site.
(The reason behind is, to test 'one day' migration from 1.5.24 to 1.7)

What I did:
a) via FTP: transferred: com_phocagallery
b) images/phocagallery (some)
c) mainmenu: Galerie
d) exported and then: imported to test-site: part of MySYL (all data of jos_phocagallery)
e) Site/media the folder: phocagallery exist plus the images = OK
f) installed: v2.8.0 = OK
g) components > phocagallery = OK
h) categories = OK

Phocagallery, after klick to:
i) Bilder: I get the message:

Code: Select all

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/.sites/xx/sitexxxx/web/xxxxxx/libraries/joomla/database/database/mysql.php on line 344

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/.sites/xx/sitexxxx/web/xxxxxx/libraries/joomla/database/database/mysql.php on line 344 
What should I do now ecactly?
Changing as stated above in the MySQL?

Thanks for help and regards,
Christine
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by Jan »

If you find Phoca extensions useful, please support the project
christine
Phoca Hero
Phoca Hero
Posts: 2886
Joined: 28 Nov 2010, 17:20

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by christine »

Hi Jan,

thank you for your links. It's very complicated :?

I need your help please, before 'acting' wrong items.
What I made till now:

1. Site - Global Configuration - System > Debug > Yes.
2. Reloaded the page where the error occurs:
Response:

Code: Select all

 500 - Es ist ein Fehler aufgetreten 
JDatabaseMySQL::query: 1054 - Unbekanntes Tabellenfeld 'a.userid' in on clause SQL=SELECT a.*, cc.title AS category, cc.owner_id AS ownerid, u.name AS editor, v.average AS ratingavg, ua.username AS usercatname, uua.id AS uploaduserid, uua.username AS uploadusername, uua.name AS uploadname FROM jos_phocagallery AS a LEFT JOIN jos_phocagallery_categories AS cc ON cc.id = a.catid LEFT JOIN jos_phocagallery_img_votes_statistics AS v ON v.imgid = a.id LEFT JOIN jos_users AS u ON u.id = a.checked_out LEFT JOIN jos_users AS ua ON ua.id = cc.owner_id LEFT JOIN jos_users AS uua ON uua.id = a.userid ORDER BY category, a.ordering LIMIT 0, 20
Below above responses also a "Call Stack List" mentioned.

3. Then I took: install.bak file (from Phoca Gallery component ZIP package):

4. Now I should 'copy' all SQL queries (except ALTER TABLE).

Do you mean this: ?

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 '',
  `userid` int(11) NOT NULL Default '0',
  `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,
  `metakey` text,
  `metadesc` 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`)
) ENGINE=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,
  `metakey` text,
  `metadesc` text,
  `extid` varchar(255) NOT NULL default '',
  `exta` varchar(255) NOT NULL default '',
  `extu` varchar(255) NOT NULL default '',
  `extauth` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `cat_idx` (`section`,`published`,`access`),
  KEY `idx_access` (`access`),
  KEY `idx_checkout` (`checked_out`)
) ENGINE=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`)
) ENGINE=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`)
) ENGINE=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` int(11) NOT NULL default '0',
  `average` float(8,6) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=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`)
-- ) ENGINE=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`)
) ENGINE=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` int(11) NOT NULL default '0',
  `average` float(8,6) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=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`)
) ENGINE=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`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;




-- --------------------------------------
-- only updates (uncomment ( remove --) the sql queries in case you want to run them and update your gallery)
-- 2.0.0
 
Jan, I don't know, WHAT exactly I have to take/use. All 'above' ?
Of course: To delete the # before.

Sorry for the long 'codes' :wink: But may be it could help you, to find out .....

Thank you and best regards, Christine
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by Jan »

Hi, your database is missing only one column - userid, so just run the alter code:

Code: Select all

-- 2.0.0 STABLE UPDATE ONLY
-- ALTER TABLE `#__phocadownload` ADD   `userid` int(11) NOT NULL default '0' AFTER `description` ;
Your prefix is jos, so this means:

Code: Select all

ALTER TABLE `jos_phocadownload` ADD   `userid` int(11) NOT NULL default '0' AFTER `description`;
If you find Phoca extensions useful, please support the project
christine
Phoca Hero
Phoca Hero
Posts: 2886
Joined: 28 Nov 2010, 17:20

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by christine »

Hi Jan,

thank you for your answer!

The description of the link says: "... just copy all SQL queries (except ALTER TABLE ... queries) and run them in e.g. phpMyAdmin ..."

Code: Select all

ALTER TABLE `jos_phocadownload` ADD   `userid` int(11) NOT NULL default '0' AFTER `description`; 
Never had inserted something in the MySQL before :?
How should I do this? Do I have to set a 'new line' or .... what is to do exactly in the DB?

Sorry .... thank you again for your help,
regards, christine
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by Jan »

Hi, the guide is set for new install, it means installing all new tables, but on your server only one column should be added. For adding sql query in database you should use phpMyAdmin - there you can find in documentation where to paste this sql query.
See e.g. https://www.phoca.cz/documents/50-phoca/ ... -joomla-17 - there are similar actions defined, for more detailed info see phpMyAdmin help guide.

Jan
If you find Phoca extensions useful, please support the project
christine
Phoca Hero
Phoca Hero
Posts: 2886
Joined: 28 Nov 2010, 17:20

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by christine »

Hi Jan,

thank you for your answer. Before doing 'above', I think, somehting I should tell you :wink:

On the live site, hp A) I have phocagallery 2.7.5!
On the test site, hp B) I "wanted" to have also 2.7.5 for testing purposes, if 'something' goes wrong, when updating from 2.7.5 to 2.8.0

But: there was no download version 2.7.5 for test site, hp B) - so I installed 2.8.0 (fresh installation) on test hp B).
Then - I imported MySQL data and some images (FTP) to the test site hp B)

After this, above response came up. Furtheremore: I don't have Phocadownload - I hv Phocagallery.

Would you think or do you have any experience from (other) User, that (in generell) are any problems when updating from 2.7.5 to 2.8.0?

This 'why' I wanted to 'test' on hp B) - how it would work - but - on this site I only could install the 2.8.0
So, no update-test was possible ....

Should I update hp A) from 2.7.5 to 2.8.0? Of course I should :wink: But ......
Any Ideas?

Thank you again, regards Christine
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by Jan »

Hi, the best is allways use the latest version.
If you find Phoca extensions useful, please support the project
christine
Phoca Hero
Phoca Hero
Posts: 2886
Joined: 28 Nov 2010, 17:20

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by christine »

Hi Jan,

Of course .... :| But this was not my question ....

I wanted to 'test' on my test-site B) whether there are any problems with an update from 2.7.5 to 2.8.
But there was no possibility to 'load' the old version before.

Anyway, I just tried to update from 2.7.5 to 2.8 on my - live site. Bevore that, I made backup of MySql :|
When klicking: Updated needed .... The full download link are there.
I only see, that (of course) there is a download for 2.8 - but I don't want to get a 'fresh' installation'.

Could I klick onto the download version Phocagallery 2.8? There is no 'statement' shown, e.g. "update version from 2.x to 2.8
similiar when doing patch upload from J. 1.5.23 to 1.5.24 or whatever.

Thank you again for help.
regards, Christine
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48706
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error: Warning: mysql_num_rows() expects parameter 1 to

Post by Jan »

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