kheikhei 0 Newbie Poster

Hi everyone im currently working on our stat but I can't output my boss want it to be.
Below is my code,im using an spanish created database thats why some of the var. are in spanish.
Heres my problem:

I wanted to output a table like this:
DATA(fecha) HITS(numAcceos) TYPE OF CONTENT(tipoEstadistica)..

i want to add the everyday stat in my table:

EX table to output:

DATE HITS POLYTONES IMAGES GAMES totalHITS/the 3 items
7/20/2008 20 4 4 8
7/21/2008 20 4 4 8
7/22/2008 20 4 4 8
7/23/2008 20 4 4 8

currently the dates is /23/2008 so the stat is until 7/23 only

I have two tables:
naming estadisticas=where the record of stats are there but unfortunately they separate the tipoestadistica table w/c is the content name of each site.where the tipoestadistica in estadistica records only the id of the content.

tipoestadistica=(content name are record)


PLEASE HELP ME OUT

<? 
$d1 = chop($_GET["d1"]);
$d2 = chop($_GET["d2"]);
$m1 = chop($_GET["m1"]);
$m2 = chop($_GET["m2"]);
$a1 = chop($_GET["a1"]);
$a2 = chop($_GET["a2"]);

$fecha_aux = explode("-",date("Y-m-d"));

if ($d1 == '')
	{
		$d1 = '01';
	}
if ($m1 == '')
	{
		$m1 = $fecha_aux[1];
	}
if ($a1 == '')
	{
		$a1 = $fecha_aux[0];
	}

if ($d2 == '')
	{
		$d2 = $fecha_aux[2];
	}
if ($m2 == '')
	{
		$m2 = $fecha_aux[1];
	}
if ($a2 == '')
	{
		$a2 = $fecha_aux[0];
	}

$hora_1 = " 00:00:00";
$hora_2 = " 23:59:59";

$fecha_1 = $a1."/".$m1."/".$d1.$hora_1;
$fecha_2 = $a2."/".$m2."/".$d2.$hora_2;

$fecha_1_inv = $d1."/".$m1."/".$a1.$hora_1;
$fecha_2_inv = $d2."/".$m2."/".$a2.$hora_2; ?>

<?php boxtitulo_titulo("<a class=\"navegacionVertical\" href=\"\" onClick=\"blocking('nx_1'); return false\" >Wap Site Stats</a>"); ?>
<?php boxtitulo_centroIzq(); ?>

<div align="center">
		<form action="index.php">
		<table border="0" align="center">
			  <tr> 
				<td colspan="4" align="center"><font color="<? echo COLOR_texto_TABLA; ?>"><b>Select your dates:</b></font></td>
			  </tr>
			  <tr> 
				<td>Start date:</td>
				<td><select name="d1" title="d1">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
						<option value="13">13</option>
						<option value="14">14</option>
						<option value="15">15</option>
						<option value="16">16</option>
						<option value="17">17</option>
						<option value="18">18</option>
						<option value="19">19</option>
						<option value="20">20</option>
						<option value="21">21</option>
						<option value="22">22</option>
						<option value="23">23</option>
						<option value="24">24</option>
						<option value="25">25</option>
						<option value="26">26</option>
						<option value="27">27</option>
						<option value="28">28</option>
						<option value="29">29</option>
						<option value="30">30</option>
						<option value="31">31</option>
				  </select>
				</td>
				<td><select name="m1" title="m1">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
				  </select>
				</td>
				<td><select name="a1" title="a1">
						<option value="2008" selected="selected">2008</option>
						<option value="2009" >2009</option>
				  	</select>
				</td>
			  </tr>
			  <tr> 
				<td height="30">End date:</td>
				<td>
					<select name="d2" title="d2">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
						<option value="13">13</option>
						<option value="14">14</option>
						<option value="15">15</option>
						<option value="16">16</option>
						<option value="17">17</option>
						<option value="18">18</option>
						<option value="19">19</option>
						<option value="20">20</option>
						<option value="21">21</option>
						<option value="22">22</option>
						<option value="23">23</option>
						<option value="24">24</option>
						<option value="25">25</option>
						<option value="26">26</option>
						<option value="27">27</option>
						<option value="28">28</option>
						<option value="29">29</option>
						<option value="30">30</option>
						<option value="31">31</option>
				  </select>
				</td>
				<td>
					<select name="m2" title="m2">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
					</select>
				</td>
				<td>
					<select name="a2" title="a2">
						<option value="2008" selected="selected">2008</option>
						<option value="2009">2009</option>
				  	</select>
				</td>
			  </tr>
			  <tr align="center">
				  <td colspan="4" align="center">
						<input type="submit" value="Send" />
				  </td>
			  </tr>			  
		</table>
		</form>
	</div>


<?php

	$BBDD = ConectarAbbdd($cbd); //conection to the data base
	
	//Access information
	$sql_datos_accesos = "SELECT count(id) AS numAccesos FROM estadisticas WHERE fecha BETWEEN  '".$fecha_1."' AND '".$fecha_2."' AND  tipoEstadistica_id = '1' and siteEstadistica_id = '1'";
					
	$rs_datos_accesos = mysql_query($sql_datos_accesos, $BBDD);
	
	if (mysql_num_rows($rs_datos_accesos)!==0)
		{
			$consulta_accesos = mysql_fetch_array($rs_datos_accesos);
			$num_accesos = $consulta_accesos["numAccesos"];
		}
	else
		{
			$num_accesos = 0;
		}
	
	echo "Access: " . $num_accesos . "<br/>";
	
	
	
	//download information
		$sql_datos_descargas = "SELECT count( id ) AS numDescargas, tipoEstadistica_id FROM estadisticas WHERE fecha BETWEEN '".$fecha_1."' AND '".$fecha_2."' AND `tipoEstadistica_id` > 1 AND `tipoEstadistica_id` < 21 GROUP BY tipoEstadistica_id";
					
	$rs_datos_descargas = mysql_query($sql_datos_descargas, $BBDD);
	
	if (mysql_num_rows($rs_datos_descargas)!==0)
		{
		
			while ($consulta_descargas = mysql_fetch_array($rs_datos_descargas))
				{
					$tipoEstadistica = $consulta_descargas["tipoEstadistica_id"];
					$num_descargas = $consulta_descargas["numDescargas"];
					
					echo "Type of Content: " . $tipoEstadistica . " Downloads: " . $num_descargas . "<br/>"; 
				}
		}
	
	
	

	
?>

<?php boxtitulo_centroDer(); ?> 
<?php boxtitulo_footer(); ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.