I am having an issue and was wondering if anyone could help me out. I will try to explain my issue as clearly as possible. I am trying to make a data feed so that I can implement my inventory to another website automatically. I have completed the data feed but the issue I am having is adding all vehicle images for each car. I could only get the main image to show for each car on the data feed.
This is how my database tables are set up
categories - cat_id, cat_name
pictures - key_id, veh_id, pic_name
vehicles - veh_id, cat_id, _make, _model, sub_model etc.....
Below is the code from my datafeed.php
I want to be able to show all the images that are in table pictures for each item on one line. I tried to JOIN tables vehicles and pictures but did not like the output. It listed each car on the data feed multiple times. If an car had 12 photos it would list that single car 12 times on the data feed. Any help would be greatly appreciated.
$fh = fopen($myFile, 'w');
$query = "SELECT * FROM vehicles WHERE _sold = 'STOCKED' ORDER BY _make ASC";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$current_date = date('Y-m-d');
$due_date = date("Y-m-d", strtotime( date( "Y-m-d", strtotime( date("Y-m-d") ) ) . "+2 week" ) );
$stringData = "|{$row['_make]}|{$row['_model']}| |{$row['_body']} |Damaged|{$row['_year']}| |{$row['_price']} ||{$row['_desc']} ||{$row['_title']} |{$row['_miles']}| |{$row['veh_id']}|$due_date|http://www.mywebsite.com/{$row['_year']}/{$row['_make']}/{$row['veh_id']}|http://www. mywebsite.com/{$row['veh_id']}{$row['_thumbnail']}| | | | | | | | | |Buy it Now \n";
fwrite($fh, $stringData);
} ;
fclose($fh);
include 'config/close.php';
pic_id) with GROUP BYveh_id, joining vehicles and pictures table