Jump to content

Strange Problem - Script Suddenly stopped working after a year.


Domestics

Recommended Posts

Hello everyone,

 

I have come accross a strange problem. For over a year now this script has worked perfectly, without fail and no problems. Today, the following message is shown when performing an action which has been run daily for the past year:

 

MySQL Error Occured
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

QUERY = SELECT * FROM CubeCart_category WHERE cat_id=

 

Now this is only done when running the "kelkoo" action. However, to show you the code we use on our cubecart store when performing this action it is the following:

 

include("../../includes/ini.inc.php");
include("../../includes/global.inc.php");
require_once("../../classes/db.inc.php");
$db = new db();
include_once("../../includes/functions.inc.php");
$config = fetchDbConfig("config");
include_once("../../language/".$config['defaultLang']."/lang.inc.php");
$enableSSl = 1;
include_once("../../includes/sslSwitch.inc.php");
include("../../includes/currencyVars.inc.php");
include("../includes/auth.inc.php");

if(isset($_GET['action']) && $_GET['action']=="kelkoo"){

        $db = new db();
        $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_kelkoo ORDER BY id desc";
        $results = $db->select($query);

        if($results==TRUE) {


                for($i=0; $i<count($results); $i++){

                        $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productId=".$results[$i]['productId'];
                        $name = $db->select($query);

                        $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$results[$i]['productId'];
                        $catId = $db->select($query);

                        $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_id=".$catId[0]['cat_id'];
                        $catname = $db->select($query);


                        $salePrice = salePrice($name[0]['price'], $name[0]['sale_price']);

                        if($salePrice > 0){

                                $price = $salePrice;

                        } else {

                                $price = $name[0]['price'];

                        }

                        $desc = str_replace(array(" ","\t","\r","\n","\0","\x0B","
                        "),"",strip_tags($name[0]['description']));
                        $desc = str_replace("  ","",$desc);


                        if($name[0]['image']){

                                $image =$glob['storeURL']."/images/uploads/".$name[0]['image'];

                        } else {

                                $image =$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif";
                        }


                        $kelkooContent .= "Household Appliances|".$results[$i]['type']."|".$catname[0]['cat_name']."|".$name[0]['productCode']."|||||||".$name[0]['productCode']."|".$desc."||".$image."|".$glob['storeURL']."/index.php?act=viewProd&productId=".$name[0]['productId']."|".$price."|".$results[$i]['delivery']."||In Stock||New|Single Product|0.01\r\n";

                }


        $filename = "KelkooFeed_";
        $contentLength = strlen($kelkooContent);
        $content = $kelkooContent;

        $filename .= date("dMy").".txt";
        header('Pragma: private');
        header('Cache-control: private, must-revalidate');
        header("Content-Disposition: attachment; filename=".$filename);
        header("Content-type: text/plain");
        header("Content-type: application/octet-stream");
        header("Content-length: ".$contentLength);
        header("Content-Transfer-Encoding: binary");
        echo $content;
        exit;

        }

}

 

I have checked and no server updates have been performed, infact nothing has changed but its suddenly not working. To explain its function, there is a working script which adds products to a table along with selected attributes such as a product type and a delivery cost. The script then generates a feed to use on the kelkoo price comparion website with those products selected (those added in the kelkoo table) collecting information required from those tables relevant.

 

MYSQL Version: 5.0.22

 

Any ideas? I have already tried:

 

-Restarting the webserver / mysqlserver

-Rolling back the data to yestoday where the script worked perfectly but it seems it dosnt work still.

 

 

Thank you for your help in advance.

Domestics

 

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.