session_start(); include_once($_SERVER['DOCUMENT_ROOT']."/includes/config.php"); include_once($_SERVER['DOCUMENT_ROOT']."/includes/db_connect.php"); // establish database connection include_once($_SERVER['DOCUMENT_ROOT']."/includes/inc_functions.php"); // load functions $thisSection = "Our Work"; $thisSub = "Client List"; $thisPage = ""; // Get all the clients $query_clients = "SELECT DISTINCT c.clientID, c.clientName, COUNT(pm.clientID) AS mediaExists FROM Clients c LEFT JOIN ProjectMedia pm ON pm.clientID = c.clientID GROUP BY (c.clientID) ORDER BY c.clientName ASC"; $result_clients = mysql_query($query_clients) or die ("Clients Query Failed: " .mysql_error()); $num_clients = mysql_num_rows($result_clients); // Get latest 3 clients added that have media $query_clientsLatest = "SELECT DISTINCT c.clientID, c.clientName, c.dateAdded FROM Clients c, ProjectMedia pm WHERE c.clientID = pm.clientID ORDER BY c.dateAdded DESC LIMIT 3"; $result_clientsLatest = mysql_query($query_clientsLatest) or die ("Latest Query Failed: " .mysql_error()); $num_clientsLatest = mysql_num_rows($result_clientsLatest); while ($rows_clientsLatest = mysql_fetch_array($result_clientsLatest)): $clientLatest[] = $rows_clientsLatest['clientID']; endwhile; // Get latest 3 clients that've been updated $query_clientsUpdated = "SELECT DISTINCT c.clientID, c.clientName, c.dateUpdated FROM Clients c, ProjectMedia pm WHERE c.clientID = pm.clientID ORDER BY c.dateUpdated DESC LIMIT 6"; $result_clientsUpdated = mysql_query($query_clientsUpdated) or die ("Latest Query Failed: " .mysql_error()); $num_clientsUpdated = mysql_num_rows($result_clientsUpdated); while ($rows_clientsUpdated = mysql_fetch_array($result_clientsUpdated)): $clientUpdated[] = $rows_clientsUpdated['clientID']; endwhile; // Get subnav based on client work $query_subnav = "SELECT DISTINCT m.mediumID, m.mediumName FROM Medium m ORDER BY m.mediumName ASC"; $result_subnav = mysql_query($query_subnav) or die ("Subnav Query Failed: " .mysql_error()); $num_subnav = mysql_num_rows($result_subnav); ?>