Created
May 10, 2023 11:47
-
-
Save RoelofWobben/c694c3b0d227af1a5991219c2844fbee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ONLY FOR TESTING | |
error_reporting(E_ALL); | |
$filename = "stock.csv"; | |
//Open csv file for reading | |
$file = fopen($filename, "r"); | |
$i=0; | |
if ($file !== FALSE) { | |
?> | |
<div class="phppot-container"> | |
<table class="striped"> | |
<thead> | |
<tr> | |
<th>Symbol</th></th> | |
<th>Price</th> | |
<th>Symbol</th> | |
</tr> | |
</thead> | |
<?php | |
while (!feof($file)) { | |
if($i==0) { | |
$class = "header"; | |
} | |
$data = fgetcsv($file, 1000, ","); | |
$i++; | |
if (!empty($data)) { | |
?> | |
<tr class="data"> | |
<td><?php echo $data[0]; ?></td> | |
<td> | |
<?php echo $data[2] ?>;"<?php echo $data[1]; ?> | |
</td> | |
</tr> | |
<?php } ?> | |
<?php | |
} | |
?> | |
</table> | |
</div> | |
<?php | |
} | |
fclose($file); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment