Can someone tell me why this doesn't work? If I try to loop it I end up with '0'.
$lines=file('test.txt');
foreach ($lines as $value)
{
$query="select sum(dailyUnitsSold) as dus, sum(dailyGrossSales) as dgs, count(*) as cnt from mydatatable where category like '%$value%'";
$joejoe=@mysql_query($query) or die (mysql_error());
$row = mysql_fetch_assoc($joejoe);
echo $row['dus'].'<br />'.$row['dgs'].'<br />'.$row['cnt'].'<br />';
}
I'm trying to pull some sold totals from a single table based on each product's category. For example, total sales for blue widget category, total sales for green widget category, purple widget category, etc. The problem is that the category field has multiple entries in each field, so one product row might have three or four categories, hence the LIKE bit.
Thanks for any thoughts here.