Retrieve,compare n store

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
angelena
Forum Commoner
Posts: 53
Joined: Mon Nov 22, 2004 4:10 am

Retrieve,compare n store

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

can you give us the structure of how the .dat file is written, and how the data is stored in the database?
angelena
Forum Commoner
Posts: 53
Joined: Mon Nov 22, 2004 4:10 am

Post 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




?>
Post Reply