Jump to content

What's the problem with this SQL ?


Recommended Posts

I have a cron.php, i don't want to introduce now why, it's not important, but
something is wrong in it...

this lines needs to update the my db, but it just do it with the 1st... :S

 $queryUP='UPDATE '.$tableProd.' SET ean13 = 0 WHERE id_product='.$product;
                       print $queryUP;



I don't know why....

The cron give me this feedback: (example)

Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=100656Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=102096Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101429Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101584Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=102069Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101281Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101522Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=100382Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101198Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=102030Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=102109Array
UPDATE `ps_product` SET ean13 = 0 WHERE id_product=101852cleared 12 for 7 days - OK



But it do it with only the first :S

The other part of the cron is works perfect:
(This is the hall of the cron.php)

<?php

include('xxxxxx');
include('xxxxxx');

       $table=pSQL('`'._DB_PREFIX_.'reservation`');

       $m= date("m");
       $de= date("d");
       $y= date("Y");

       $i=Configuration::get('RESERVATION_DAYS');

$date=    "'".date('Y-m-d',mktime(0,0,0,$m,($de-$i),$y))."'"; 

           $sql1='SELECT * FROM '.$table.' WHERE `date_add` <'.$date;
           $Del_Sql1 = mysql_query($sql1); 
           $num_righe = mysql_num_rows($Del_Sql1);

           $sql2='DELETE FROM '.$table.' WHERE `date_add` <'.$date;
           $Del_Sql2 = mysql_query($sql2);


                       $tableProd=pSQL('`'._DB_PREFIX_.'product`');


                    while ($row = mysql_fetch_assoc($Del_Sql1)) {
                        print $row.'
';
                         $product=$row['id_product'];;
                       $queryUP='UPDATE '.$tableProd.' SET ean13 = 0 WHERE id_product='.$product;
                       print $queryUP;
   }         
           $UP_queryUP = mysql_query($queryUP);




print 'cleared '.$num_righe.' for '.$i." days - ";


die ('OK');

?>

Link to comment
Share on other sites

×
×
  • Create New...