Jump to content

Cron Job 'Field List'?


justlukeyou

Recommended Posts

Hi,

 

I am trying to add two new category feeds into my database using a cron job however it is telling that: Unknown column 'merchant_category' in 'field list'.

 

The inputs and the column names are:

 

category_name

merchant_category

 

The problem is I dont actually know what the field list is

 

$prod = new SimpleXMLElement($domString);
                    $id = $prod->attributes();
                    $id = $id['id'];
                    $link = $prod->uri->mLink;
                    $description = mysql_real_escape_string($prod->text->name);
                    $fulldescription = mysql_real_escape_string($prod->text->desc);
	    $category_name = mysql_real_escape_string($prod->text->desc);
                    $merchant_category = mysql_real_escape_string($prod->text->desc);
	    $image = $prod->uri->awImage;
                    $retailprice = $prod->price->rrp;
                    $sellprice = $prod->price->buynow;
                    if($id) {
                        if($sellprice > 0 && $retailprice > 0) {
                            $discount = 100 - ($sellprice / $retailprice * 100);
                        } else {
                            $discount = 0;
                        }
                        echo "New product: #" . $id . " - " . $category_name . " . $merchant_category ." . $description . 

" - Discount: " . $discount . "%" . (($discount > 90.01 || $discount < 0) ? " (Not inserted)" : " (Inserted)") . "<br />" 

. $fulldescription . "<br /><br />";
                        if($discount > 0 && $discount < 90.01) {
                            $query = mysql_query("SELECT * FROM productdbasetest WHERE id = '".$id."'");
                            if(mysql_num_rows($query) > 0) {
                                $query = mysql_query("UPDATE productdbasetest SET  category_name = '".$category_name."',  

merchant_category = '".$merchant_category."', awImage = '".$image."', link = '".$link."', description = '".

$description."', fulldescription = '".$fulldescription."', price = '".$sellprice."', discount = '".round($discount)."', 

merchant = '".$merchant."' WHERE id = '".$id."'");
                            } else {
                                $query = mysql_query("INSERT INTO productdbasetest (id, category_name, merchant_category, 

awImage, link, description, fulldescription, price, discount, merchant) VALUES ('".$id."', '".$category_name."', '".

$merchant_category."', '".$image."', '".$link."', '".$description."', '".$fulldescription."', '".$sellprice."', '".round

($discount)."', '".$merchant."')");

 

Link to comment
https://forums.phpfreaks.com/topic/262946-cron-job-field-list/
Share on other sites

Brilliant thanks,

 

When I run the job nothing enters when I use the following:

 

    $category_name = $prod->uri->category_name;

                    $merchant_category = $prod->uri->merchant_category;

 

But I thought that this mean that the input is the same as my column names.

 

For example with this one I am changing the input from image to 'awImage'

 

$image = $prod->uri->awImage;

Link to comment
https://forums.phpfreaks.com/topic/262946-cron-job-field-list/#findComment-1347722
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.