Page 1 of 1

Retrieve,compare n store

Posted: Wed Jan 05, 2005 10:01 pm
by angelena
Following is part of the thing i needed to do :
To create a program to read details from a .dat file, store its contents in a table, and to process and match its contents with another table. Once match is found, data is sent back to a .dat file, and stored in a specific directory.

I have started on it with the following code :

Code: Select all

<?php

$file = "mydata.dat";                   
$data = file($file);                      
foreach($data as $line){                  
  $parts = explode("|", $line);           
  print_r($parts);                        
 }
 


$dirupload = 'D:/server/images/';        
mkdir ($dirupload, 0700);                
chdir('./');                             
?>
Im not sure how am i going to compare my data from the text file with the data i get from my db.

ANyone could pls show me the way ?Thankss :)


feyd | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Wed Jan 05, 2005 10:17 pm
by feyd
can you give us the structure of how the .dat file is written, and how the data is stored in the database?

Posted: Wed Jan 05, 2005 10:22 pm
by angelena
Opsss...sory bout the code tag..

The example of the .dat file is as follow :
Apple bakery|Birthday Cake|Tiramisu
Orange Bakery|Desserts|Mud Cake

The db fields is as follow :
Branch,Category,Name




?>