PDA

Click to See Complete Forum and Search --> : Undefined offset


RameshChaudhary
Nov 30th, 2006, 02:43 AM
I am getting Undefined notice. Could anybody help out. Below are code
-------------------------------
<?PHP set_time_limit(0); require("./dbconfig/db_connect.php");
//////////////////////////////////////SEARCH BARCODE TAG//////////////////////

$lines = glob("D:/nusphere/apache/htdocs/Msafe/phonoApp/final/ftp_downloaded/*.txt");
for($i=0;$i<sizeof($lines);$i++){ $fp=fopen($lines[$i],"r+") or die("error opening");
$file_content =fread($fp,filesize($lines[$i]));
fclose($fp);
$arrContent=explode("\n",$file_content);
//print_r($arrContent);
//check to see if this is your search string
SizeOf($arrContent);
$barCodeinfo="";
$trackOrder=0;
$updateRecordCount=0; for($j=0;$j<sizeof($arrContent);$j++){ $arrData=explode(";",$arrContent[$j]);

$barCode=$arrData[0];
$SoundLink=$arrData[3];
$Supplier_TrackID=$arrData[1];

if($barCode<>$barCodeinfo){ $barCodeinfo=$barCode;
$trackOrder=0; } else $trackOrder++;
// echo "SELECT tbltracks.* FROM tbltracks,tblcollection WHERE tblcollection.barcode='".str_replace("'","''",trim($barCode))."' ORDER BY tbltracks.ID Limit ".($trackOrder).",1"."</br>"; // echo "UPDATE tbltracks SET Sound_Links='".($SoundLink)."' WHERE ID ='{$row['ID']}'"."</br>"; $rec = mysql_query("SELECT tbltracks.* FROM tbltracks,tblcollection WHERE tbltracks.FT_SuplProdID=tblcollection.suplprodid and tblcollection.barcode='".str_replace("'","''",trim($barCode))."' ORDER BY tbltracks.ID Limit ".($trackOrder).",1"); $updateRecordCount++; //OK if ($row = mysql_fetch_array($rec)){ mysql_query("UPDATE tbltracks SET Sound_Links='".($SoundLink)."' WHERE ID ='{$row['ID']}'"); echo "Updating ......................."; } else{}; } if($updateRecordCount%50) sleep(1); } ?>
-------------------------------

Thanks
Ramesh chaudhary

kows
Nov 30th, 2006, 09:08 AM
I'm not going to look through your jumbled mess of code. if you want help, you're going to need to sort all of that out for yourself, and post it so that it's READABLE.

however, if the red highlighted line is the problem, then it's probably because your explode() isn't picking up $arrData[3], which means it doesn't have 4 items in it. you could suppress the error by defining the $arrData variables with @$arrData[3], or you could check if they exist before assigning them values. either way, that value will still be blank.

you could also edit your PHP.ini to turn down the level of your error_reporting so that notices like that won't be displayed.

penagate
Nov 30th, 2006, 10:50 AM
you could also edit your PHP.ini to turn down the level of your error_reporting so that notices like that won't be displayed.

That's a disastarous idea. Errors and notices should be fixed, not hidden.

kows
Nov 30th, 2006, 06:11 PM
I didn't say it was a good idea, I just said that he could.

penagate
Nov 30th, 2006, 10:36 PM
But you didn't say it wasn't a good idea either, thus giving the impression that you endorse it.