emexinc Posted January 30, 2010 Share Posted January 30, 2010 I have placed a FOR LOOP in a FOR LOOP, I am not getting any error messages, but my echo statement at the end is not being displayed, as well as the fact that the data for the most part is being inserted, but when the first file is checked against the second something is not working, because under the poplar column i still have 'y' where it should of switched it with a price...thanks for the help...darwin $Chunks = strtolower($Chunks); $Chunks = str_replace('"', '', "$Chunks"); $Chunks = explode("\r\n", $data); for($i = 0; $i < count($Chunks); $i++){ list($page,$item_number_1,$size,$info,$pricing,$pine,$poplar,$red_oak,$white_oak,$alder,$fir,$hemlock,$maple,$cherry,$hickory,$mahogany,$lyptus,$brazillian_cherry,$beech,$maple_with_leaf,$mdf,$birch,$walnut) = split('[,]', $Chunks[$i]); if($poplar == 'y'){ $theData = str_replace('"', '', "$theData"); $wordChunks = explode("\r\n", $theData); for($s = 0; $s < count($wordChunks); $s++){ list($item_number_2, $price) = split('[,]', $wordChunks[$s]); if($item_number_1 == $item_number_2){$poplar = $price;}; }; }; mysql_query("INSERT INTO alldata (page,item_number_1,size,info,pricing,pine,poplar,red_oak,white_oak,alder,fir,hemlock,maple,cherry,hickory,mahogany,lyptus,brazillian_cherry,beech,maple_with_leaf,mdf,birch,walnut) VALUES('$page','$item_number_1','$size','$info','$pricing','$pine','$poplar','$red_oak','$white_oak','$alder','$fir','$hemlock','$maple','$cherry','$hickory','$mahogany','$lyptus','$brazillian_cherry','$beech','$maple_with_leaf','$mdf','$birch','$walnut')") or die('Error, query failed: '.mysql_error()); }; echo "Importing all information complete"; Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 30, 2010 Share Posted January 30, 2010 it could be because you have semi-colons after you braces try this: <?php $Chunks = strtolower($Chunks); $Chunks = str_replace('"', '', "$Chunks"); $Chunks = explode("\r\n", $data); for($i = 0; $i < count($Chunks); $i++){ list($page,$item_number_1,$size,$info,$pricing,$pine,$poplar,$red_oak,$white_oak,$alder,$fir,$hemlock,$maple,$cherry,$hickory,$mahogany,$lyptus,$brazillian_cherry,$beech,$maple_with_leaf,$mdf,$birch,$walnut) = split('[,]', $Chunks[$i]); if($poplar == 'y'){ $theData = str_replace('"', '', "$theData"); $wordChunks = explode("\r\n", $theData); for($s = 0; $s < count($wordChunks); $s++){ list($item_number_2, $price) = split('[,]', $wordChunks[$s]); if($item_number_1 == $item_number_2){$poplar = $price;}; } } mysql_query("INSERT INTO alldata (page,item_number_1,size,info,pricing,pine,poplar,red_oak,white_oak,alder,fir,hemlock,maple,cherry,hickory,mahogany,lyptus,brazillian_cherry,beech,maple_with_leaf,mdf,birch,walnut) VALUES('$page','$item_number_1','$size','$info','$pricing','$pine','$poplar','$red_oak','$white_oak','$alder','$fir','$hemlock','$maple','$cherry','$hickory','$mahogany','$lyptus','$brazillian_cherry','$beech','$maple_with_leaf','$mdf','$birch','$walnut')") or die('Error, query failed: '.mysql_error()); } echo "Importing all information complete"; ?> Quote Link to comment Share on other sites More sharing options...
emexinc Posted January 30, 2010 Author Share Posted January 30, 2010 ...i've tried your fix and that didn't change anything...do you have any other ideas? How can the page be displayed even though it's obviously running into an error and not displaying a simple echo statement at the end?...thanks again for your help... Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 31, 2010 Share Posted January 31, 2010 at the very beginning of your script (before anything else is run), place this: ini_set('display_errors', 1); Quote Link to comment Share on other sites More sharing options...
emexinc Posted January 31, 2010 Author Share Posted January 31, 2010 ...it does not display any errors...i found another post where i link that page to a new one where it then can do an error check (i wish i could explain it better) and the only repeated item that i comes up with is "Undefined Offset: " with various numbers all from the same line of code in my file. list($page,$item_number_1,$size,$info,$pricing,$pine,$poplar,$red_oak,$white_oak,$alder,$fir,$hemlock,$maple,$cherry,$hickory,$mahogany,$lyptus,$brazillian_cherry,$beech,$maple_with_leaf,$mdf,$birch,$walnut) = split('[,]', $Chunks[$i]); ...from splitting this line of code among different lines, it seems the last part is causing this... ) = split('[,]', $Chunks[$i]); ...i don't know where to go from here...thanks for all the help...darwin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.