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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.