fifin04 Posted March 22, 2010 Share Posted March 22, 2010 Hi..guys...jyst need some little help here...kind of stuck here...hope will get some help here...here's the scenario I have some array data retrive from textfile and has to do some schedule task agains dtbase data...so my problem is ...I can't find the solution to store the unmatch dt texfile agains db data store in others array and store the match data textfile in another array..let say's here... matchWithDBDTarray = array();-->store the data textfile match with db data notMatchWithDBDTarray = array();-->store the data textfile not match with db data here's the summary of all my pitfall... //some dummy data extract from DB $dbArrayData = array(array("A001","B"),array("A002","B"),array("A003","B"),array("A004","B"),array("A005","B"),array("A006","B"),array("A007","B"),array("A008","B"),array("A009","B"),array("A010","B"),array("A011","B"),array("A012","B")); //some dummy data extract from textfile $txtFileData = array(array("A001","B"),array("A002","B"),array("A020","B"),array("A021","B"),array("A022","B")); //start looping $txtFileData for($i=0;$i<count($txtFileData);$i++){ //using built-in php array fucntions array_walk($dbArrayData,"matchingWithDBData",$txtFileData[$i]); } function matchingWithDBData($valueDB,$key,$txtDtArr){ if($txtDtArr[0] == $valueDB[0]){ echo " <strong><font color='#FF9900'>MATCH</font></strong> <br/>"; //match data will save in matchWithDBDTarray }else{ echo " <strong><font color='#FF0000'>NOT MATCH</font></strong>"; echo $key." : DB = ".$valueDB[0]." || TXT = ".$txtDtArr[0]."<br/>"; //unmatch data will save in notMatchWithDBDTarray } } Hope someone will shoow me or give me some tips ..go on this...because the real db data sometimes it's about 1000..is ther any others solution to overcome this...really need help..as I struggle to it..tq in advanced.. Link to comment https://forums.phpfreaks.com/topic/196107-need-help-with-array_walk/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.