Hi guys,
You'll prob find this question very simple, but I'm fairly new to PHP and this is doing my nut in!! 🙁
I need my script to add up the number of records in my database which have a specific field name. For example i have a column with "counties" in, i would like to add up the records with the county Somerset in that cell. I'm thinking its something along the lines of if $county = Somerset => count $county
Im using a flatfile database, since Im not using a lot of data. Below is my code so far without this sum function...
<?php
$fp = fopen('data.csv','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
while (!feof($fp)) {
$line = fgets($fp, 2048);
list ($country, $county, $campsite, $town, $address, $postcode) = split ('\,', $line);
NEED YOUR FUNCTION HERE PLEASE!! :)
}
$fp++;
}
fclose($fp);
?>
Thank you so much for ay help that you can offer,
Craig