Hi Everyone, I am at loss so I am hoping your wisdom can help me. I originally had a script that first got a list of terms to be searched from the file uploaded in the first part. This list is stored in the array $snp. Every item in $snp occurs once for every entry i have in the table. The goal is to allow the user to select a set in the file uploaded and get every entry for a given project, which is entered via POST. I had originally wrote this in way that it made 3 or 4 calls to the database and it was way to slow, so I tried to make one call to the database and put everything in a multidimensional array. Now, what I have below seems to work, but I get 3notices for every iteration of the foreach($rows as $ids) and I can't figure out for the life of me why. *Notice*: Undefined index: in */Applications/MAMP/htdocs/catcnew/snppitv1.php* on line *62* *Notice*: Undefined index: in */Applications/MAMP/htdocs/catcnew/snppitv1.php* on line *63* *Notice*: Array to string conversion in */Applications/MAMP/htdocs/catcnew/snppitv1.php* on line *66* I guess I would like to know what it is going on out of curiosity and if it can cause a problem down the road. Also, any suggestions on improvement are always welcome. if(isset($_FILES['snps'])) { $dir = 'uploads'; $header = "role\t"; $filename = $_FILES['snps']['name']; if (file_exists("$dir/$filename")) { die ("A file with this name already exists in the database <br />"); } else { move_uploaded_file($_FILES['snps']['tmp_name'], "$dir/$filename"); echo "Uploaded file '$filename' <br />"; $fh = fopen("$dir/$filename", 'r') or die("File does not exist or you lack permission to open it"); } while (!feof($fh)) { $line = fgets($fh); $snp[] = trim(preg_replace('/\n/', '', $line)); } foreach ($snp as $loci) { $header .= $loci . "\t" . $loci . "\t"; } } if(isset($_POST['project'])) { $project = sanitizeStrings($_POST['project']); $body = ""; $query = "SELECT * FROM genotyped WHERE projectid='$project'"; $result = queryMysql($query); if(mysqli_num_rows($result)) { $data = array(); while($row = mysqli_fetch_row($result)) { $rows[] = $row[2]; $role[$row[2]] = $row[3]; $data[$row[2]][$row[6]]['alelleY'] = $row[7]; $data[$row[2]][$row[6]]['alelleX'] = $row[8]; } $rows = array_unique($rows); foreach($rows as $ids) { $col2 = $role[$ids]; $alelleX = $alelleY = $content = ""; foreach($snp as $loci) { $alelleY = $data[$ids][$loci]['alelleY']; $alelleX = $data[$ids][$loci]['alelleX']; $content .= "$alelleY\t$alelleX\t"; } $body .= "$ids\t$role\t" . substr($content, 0, -1) . "\n"; } } } unlink("$dir/$filename"); ?> T. -- "Education is not to be used to promote obscurantism." - Theodonius Dobzhansky. "Gracias a la vida que me ha dado tanto Me ha dado el sonido y el abecedario Con él, las palabras que pienso y declaro Madre, amigo, hermano Y luz alumbrando la ruta del alma del que estoy amando Gracias a la vida que me ha dado tanto Me ha dado la marcha de mis pies cansados Con ellos anduve ciudades y charcos Playas y desiertos, montañas y llanos Y la casa tuya, tu calle y tu patio" Violeta Parra - Gracias a la Vida Tiago S. F. Hori. PhD. Ocean Science Center-Memorial University of Newfoundland