KDM Posted January 10, 2011 Share Posted January 10, 2011 on line 53. Line 53 $ezdb->quick_insert('iid_ip', array('iid' => $_iid, 'ip' => $_ip)); The entire block of code /* Update table `iid_ip`. Between the dashed lines is the create statement used to create the image view count (iid_ip) table. ---------------------------------------- delimiter $$ CREATE TABLE `iid_ip` ( `iid` int(11) unsigned NOT NULL COMMENT 'Image id from where the count is the number of unique views.', `ip` varchar(15) NOT NULL COMMENT 'The ip of the visitor.', PRIMARY KEY (`iid`), KEY `ip` (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for view count of image using unique ip''s.'$$ ---------------------------------------- */// Escape variables that are used in the query. $_ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $_iid = mysql_real_escape_string($imageid); // Count is 0 if ip has NOT seen the images, else count is 1 $_count = $ezdb->get_var("SELECT COUNT(*) FROM `iid_ip` WHERE `iid`='$_iid' AND `ip`='$_ip'"); if (!$_count) { // Insert the unique combination of image id and visitor ip in `iid_ip`. $ezdb->quick_insert('iid_ip', array('iid' => $_iid, 'ip' => $_ip)); } // Get count of image views. $_views = $ezdb->get_var("SELECT COUNT(*) FROM `iid_ip` WHERE `iid`='$_iid'"); // And format, thousands seperator is a comma, no decimals. $_views = number_format($_views, 0, '', ','); ///////////////////////////// Link to comment https://forums.phpfreaks.com/topic/223968-undefined-method-error/ Share on other sites More sharing options...
BlueSkyIS Posted January 10, 2011 Share Posted January 10, 2011 where is $ezdb defined? Link to comment https://forums.phpfreaks.com/topic/223968-undefined-method-error/#findComment-1157409 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2011 Share Posted January 10, 2011 Best guess is that whatever class $ezdb is an instance of, does not contain a method named quick_insert() Link to comment https://forums.phpfreaks.com/topic/223968-undefined-method-error/#findComment-1157410 Share on other sites More sharing options...
KDM Posted January 10, 2011 Author Share Posted January 10, 2011 thanks guys this worked $_views = $ezdb->get_var("SELECT COUNT(*) FROM `iid_ip` WHERE `iid`='$_iid'"); Link to comment https://forums.phpfreaks.com/topic/223968-undefined-method-error/#findComment-1157441 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.