Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-11-2011 09:55:39

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Hunting For Duplicates In The Database - A Simple Checker

This is a simple script that can be modified to enable checking for duplicates in the store database. - Just put it together as a webstore page and use the id as the page name in order to navigate to it.  Remember that you will not be able to make it HTTPS if you have your site SEO set to TRUE (no HTTPS SEO in CCP 6.0) ...and that account holders in your webstore will be able to access the page (although non-account holders,  visitors, guest checkout users, etc. should not be able to).


Code:

<?php 

if ($this->globals('khxc_user.id')) {

include '/var/wetsocks.php';

mysql_pconnect("$s", "$u", "$p") or die(mysql_error());
mysql_select_db("$d") or die(mysql_error());

// test for duplicate mpn.
$duplicate = mysql_query("SELECT mpn FROM gbu0_prod GROUP BY mpn having count(*) > 1 ORDER BY mpn") or die(mysql_error());

// $query = "SELECT type, COUNT(name) FROM products GROUP BY type"; 

// Print out result
while($row = mysql_fetch_array($duplicate)){

     print '<table border="0" cellpadding="0" cellspacing="10px"><tr><td style="text-align: justify;">' . $row['mpn'] . '</td></tr></table><br /><br />';
     
} // End of while statement.

} // End of if statement.

?>

You will also need your very own .

The recipe is simple. - Just create a file, give it a .php file extension, and then enter something like the following (using your own database name, username, password, etc.):


Code:

<?php

$d = 'smouldering_footwear';
$u = 'cheesey';
$p = 'trainers';
$s = 'localhost';

?>

Last edited by Design_Wholesale (02-11-2011 09:56:22)

Offline

 

Board footer