RossCode 0 Newbie Poster

Hello, hopefully someone can help me figure this out. I have 2 files that hold information based on properties and I have to try and generate a feed from both and relate them together.

One of the files holds the images, the other holds all the information relating to the property. Each property shares a common id but there are no table names in the CSVs at all so I'm finding it tricky to marry up or even figure how to best generate a mySQL database from the files if that would ultimately make the task easier.

An example of the feeds are as follows. I have bold the IDs that relate the property to the images.

Property

"3918","683","2","2","East Allcourt","Lechlade","Gloucestershire","GL7 3FB","GL7 3FB","295000","Leasehold","House","3","2","3","Superb Cotswold stone Beechcroft home for over 55's<br/><br/>Three Reception Rooms   Two Bedrooms   Two Bathrooms<br/><br/>The property is close to the historic heart of Lechlade, a small Cotswold town attractively situated alongside water meadows at the highest navigable point of the River Thames. Its central location offers easy access to the M4, M40 and M5 motorways. Cirencester (13 miles), Oxford (25 miles) and Swindon (11 miles) are all within easy reach. There is a thriving, friendly community with many active clubs and societies, good schooling in the area and sufficient shops and facilities in the town to cater for day-to-day needs.<br/><br/>For further information or to arrange a viewing, please contact Elaine Jones or Lynda Larner on 01367 252541.","08/Apr/2010 15:52","","","","","","","","","12'11 x 10'10","10'10 x 10'2max","","","","","14'5 x 12'9","12'10 x 10'1","6'7 x 6'3","","13'10 x 7'8","","","","","","","","","","","","","62","L6036","0","A","1","1","1","0","[B]12877373[/B]","55","60","51","54","3","","(Not Specified)","","0","0","0","0","(Not Specified)","East Allcourt, Lechlade, Gloucestershire, GL7 ","0","0","0",""

"91489","683","1","28 Poulton Hill Cottages","","Poulton","","GL7 5JA","GL7 5JA","845","PCM","Cottage","1","3","1","Opportunity to rent this bright and spacious SEMI DETACHED 3 BED COTTAGE situated just outside the village of Poulton. The accommodation comprises entrance hall with exposed stone wall which leads into a good size SITTING ROOM WITH STONE FIREPLACE. The EAT IN KITCHEN has a variety of wall and base units, electric cooker, washing machine, fridge/freezer and space for dining table. The BATHROOM has a white suite with a bath and shower over. Upstairs is the MASTER BEDROOM with a deep airing cupboard and FAR REACHING VIEWS OVER FARMLAND. There is a further DOUBLE bedroom and a SINGLE ROOM. <br/><br/>The cottage is set with in its own extensive GARDEN, to the front is a lawn edged with flower borders, to the rear are extensive gardens with trees and space for growing vegetables. There is a single GARAGE and plenty of off road parking.<br/><br/>Located between Poulton and Down Ampney the cottage is ideally situated to commute to both Cirencester and Swindon.<br/>","05/May/2010 11:57","Semi Detached cottage","Three bedrooms","Lounge","Kitchen/breakfast room","Fireplace","Large gardens","Garage","Rural location","13'9 x 10'5","11'2 x 10'2","9'2 x 7'3","","","","13'9 x 12'2","","","","13'9 x 9'6","","","","","","","","","","","","","6","","1","C","2","1","1","0","[B]20062200[/B]","35","37","22","23","2","","(Not Specified)","","0","0","0","0","(Not Specified)","Poulton","0","0","0",""

Images

"[B]12877373[/B]","http://images.somesite.com/mooreallen/sales/ecimage1/2eastall.jpg","0","1",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage2/2eastall.jpg","0","2",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage3/2eastall.jpg","0","3",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage4/2eastall.jpg","0","4",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage5/2eastall.jpg","0","5",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage6/2eastall.jpg","0","6",""
"12877373","http://images.somesite.com/mooreallen/sales/ecimage7/2eastall.jpg","0","7",""
"[B]20062200[/B]","http://images.somesite.com/mooreallen/rentals/ecimage1/001c0091489.jpg","0","1",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage2/001c0091489.jpg","0","2",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage3/001c0091489.jpg","0","3",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage4/001c0091489.jpg","0","4",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage5/001c0091489.jpg","0","5",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage6/001c0091489.jpg","0","6",""
"20062200","http://images.somesite.com/mooreallen/rentals/ecimage7/001c0091489.jpg","0","7",""

What I have so far that shows 1 image per property is this but how do I take the info from the other CSV to marry up the text?

<?php
$row = 0;
$Images = 'feed/images.txt';
$Props = 'feed/properties.txt';

   
while (($data = fgetcsv($Images, 1000, ",")) !== FALSE) {
        $num = count($data);
        $row++;

        for ($c=0; $c < $num; $c++) {
		
		// preg_match to narrow images down to 1 per property for display
if (preg_match("/http:\/\/images.somesite.com\/mooreallen\/sales\/ecimage1\//", $data[$c] )) {
		//Count show 20 only
      if($count <= 20){         
echo "<img src=' " . $data[$c] . " ' alt=' ".$data[0]." ' />";

}

$count++;
        }
}


}
fclose($Images);
?>

If someone could possibly help that would be great. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.