Ver Mensaje Individual
  #20 (permalink)  
Antiguo 18/03/2011, 09:28
andoencombi
 
Fecha de Ingreso: febrero-2011
Mensajes: 195
Antigüedad: 15 años, 8 meses
Puntos: 1
Respuesta: ayuda porfavor amigos

este es el ultimo codigo que utilice ya con lo que me indicaste jaronu

Código PHP:
<?php
 
$bd_host 
= "localhost"; 
$bd_usuario = "root"; 
$bd_password = ""; 
$bd_base = "test"; 
 
$con = mysql_connect($bd_host, $bd_usuario, $bd_password); 
 
mysql_select_db($bd_base, $con); 
 
echo 
"<table border='1'>
  <tr>
  <td>Enero</td>
  <td>Febrero</td>
  <td>Marzo</td>
  <td>Abril</td>
  <td>Mayo</td>
  <td>Junio</td>
  <td>Julio</td>
  <td>Agosto</td>
  <td>Septiembre</td>
  <td>Octubre</td>
  <td>Noviembre</td>
  <td>Diciembre</td>
  </tr>
  <tr>"
;
 
for ( 
$i = 1 ; $i <= 12 ; $i ++)
      {
          
$sql=mysql_query("SELECT COUNT(month(fecha)) AS cantidad FROM alguna WHERE month(fecha) = $i",$con); 
          
$resultado = mysql_fetch_array($sql);
          echo 
$resultado['fecha'];
      }
echo 
"</tr>";
?>
no se si tenga algo que ver la base de datos la pongo tambien

Código PHP:
CREATE TABLE IF NOT EXISTS `alguna` (
  `
fecha` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- 
Volcar la base de datos para la tabla `alguna`
--

INSERT INTO `alguna` (`fecha`) VALUES
('2011-03-18'),
(
'2011-04-13'),
(
'2011-03-16');