Jump to content

undefined method error


KDM

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.