NogDog
Thanks. Yes that is what I thought it should not throw a warning. I was looking for that code bit but didn't see it as an option thought maybe it had been removed on this new update of the forum. So here is the code that I was working on at the time I asked that question.
$custshop=(isset($cnfig['cust_shop']))?$cnfig['cust_shop']:$_SESSIOn['shop'];
$query="select bonus.id, bonus.custid, bonus.bonus, bonus.wdisc,cust.lname, cust.fname, cust.email, bonus.pdate,bonus.maillist from `bonus`, `cust` where bonus.custid=cust.id and bonus.shop='".$custshop."'and cust.email!=''";
$x=1;
$result=querymeres($query);
if(is_object($result)and $result->num_rows>='1'){
while($row =$result->fetch_object()){
if($row->wdisc>"1"){
$custtype="wholesale";
}else{
$custtype="retail";
}
#accumulate the ones to be updated into an array. and update bonus file.
if(($row->pdate>$row->maillist )| $row->maillist==NULL){#recent purchase
$mlist[$x]=$row->id."|".$row->email."|".$row->fname."|".$row->lname."|".$row->bonus."|".$custtype."|";
$queryub="update `bonus` set `maillist`='".$tday."' where `id`='".$row->id."'";
queryme($queryub);
$x++;
}
}
mysqli_close($mysqli);
#now update the mailing list.
include('./bits/connect.dada.php');
for($m=1;$m<=$x-1;$m++){
$custinfo=explode('|',$mlist[$m]);
$queryf="select * from `dada_subscribers` where `email`='".$custinfo[1]."' and `list`='".$cnfig['mlist']."'";
$resultf=querymeres($queryf);
if(is_object($resultf)and $resultf->num_rows>='1'){;
$queryu="update `dada_profile_fields` set `firstname`='".$custinfo[2]."', `lastname`='".$custinfo[3]."',`choice1`='".$custinfo[4]."',`choice2`='".$custinfo[5]."',`sub_source`='".substr($cnfig['domain'],0,-4)."Sales',`choice3`=NOW() where `email`='".$custinfo[1]."'";
echo $custinfo[1]." Name and Date Updated<br>\n";
queryme($queryu);
}else{
$query2="insert into `dada_subscribers` (`email`,`list`,`list_type`,`list_status`)values('".$custinfo[1]."','".$cnfig['mlist']."','list','1')";
echo $custinfo[1]." Added to list<br>\n";
queryme($query2);
$queryf2="select * from `dada_profile_fields` where `email`='".$custinfo[1]."'";
$resultf2=querymeres($queryf2);
if(is_object($resultf2)and $resultf2->num_rows>='1'){;
$queryu2="update `dada_profile_fields` set `firstname`='".$custinfo[2]."', `lastname`='".$custinfo[3]."',`choice1`='".$custinfo[4]."',`choice2`='".$custinfo[5]."',`sub_source`='".substr($cnfig['domain'],0,-4)."Sales',`choice3`=NOW() where `email`='".$custinfo[1]."'";
queryme($queryu2);
}else{
$query3="insert into dada_profile_fields (`email`,`firstname`,`lastname`,`choice1`,`choice2`,`sub_source`,`choice3`)values('".$custinfo[1]."','".$custinfo[2]."','".$custinfo[3]."','".$custinfo[4]."','".$custinfo[5]."','".substr($cnfig['domain'],0,-4)."Sales', NOW())";
queryme($query3);
}
}
}
mysqli_close($mysqli);
as for the exact warning. Well I've been trying to eliminate these warnings and I delete the error log as I go so all I can tell you is as near as I recall. It said "index 5 undefined" or "index 4 undefined" either of which could easily be NULL or ''. As I recall I eliminated the warning by adding another | to the end of the array load. So would it not comeback as set if it is the last item in the explode and is say NULL or ''?
bonus Index decimal(6,2) can be NULL
wdisc Index float(5,2) defaults to 0.00 but also set as can be NULL
pdate date can be NULL
maillist date can be NULL
OH I'm running Bitnami on my local machine. PHP version: 7.1.19
I always get the weird stuff.