$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT total.date, DAYNAME(total.date) AS dayname, YEAR(total.date) AS year, WEEK(total.date) AS week, DAYOFWEEK(total.date) AS dayofweek, total.visits AS total_visits, firstv.first_count AS new_visits
FROM (SELECT date, COUNT(shop_visit_id) AS visits FROM shops s LEFT JOIN shop_hours sh ON s.shop_id = sh.shop_id GROUP BY date) AS total
LEFT JOIN (SELECT first_date, COUNT(contact_id) AS first_count FROM (SELECT sh.contact_id, MIN(s.date) as first_date, DAYNAME(MIN(s.date)) AS day_name FROM shops s LEFT JOIN shop_hours sh ON sh.shop_id=s.shop_id GROUP BY sh.contact_id) AS first_visits GROUP BY first_date) AS firstv
ON total.date = firstv.first_date ORDER BY total.date DESC";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop