I have a CSV file containing multiple columns, I would like to sort and filter like I do with SQL.
CSV structure -
Type | Vin | DateInStock
New | 675F | 12/06/19
Used | 7643 | 12/05/19
etc..
Here is my PHP file -
$fh = fopen('myFile.csv', 'r');
while($line = fgetcsv($fh)) {
$type[] = array($line[0]);
$vin[] = array($line[1]);
$date[] = array($line[2]);
}
So What I would normally do is
"SELECT * FROM table WHERE type = 'Used' AND date = '$todays_date'";
Then echo out all the Vin numbers
$vin = $row['vin'];
I can get an array of the type, vin and date but not sure how to just display vin's that are from todays date and have a type of Used. What would I do to accomplish this? I tried this for just getting vin numbers with the type Used -
foreach($type as $t){
$recall_type = $t[0];
if($recall_type == 'Used'){
foreach ( $vin as $value ){
$recall_vin = $value[0];
$recall_vin.'<br>';
}
}
}
But that just echos out the same vin pattern hundreds of times..