Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/02/2011, 06:16
luisoroz
 
Fecha de Ingreso: febrero-2011
Mensajes: 4
Antigüedad: 13 años, 3 meses
Puntos: 0
Problema con mysql_fetch_assoc() y mysql_free_result()

Hola, tengo un problema con una aplicación



al introducir las fechas y darle a buscar me da esos errores que muestra la imagen, el codigo es el siguiente:

tres.php

<?
$sql = "SELECT * FROM cur09,empresas";
$sql .=" WHERE fecha BETWEEN '$f_inicio' AND '$f_fin' and comercial='$comercial' and cur09.id_empresas=empresas.id_empresas";
$sql .=" ORDER BY id_curso";
$re= mysql_query($sql);
$conta=0;
$color="#CCCCCC";
$color2="#AEAEAE";
while ($tupla = mysql_fetch_assoc($re)){
if(substr($f_fin,0,4)==$ejercicio){
if ($conta % 2 == 0){
echo "<tr bgcolor='#CCCCCC'>";
}else{
echo "<tr bgcolor='#E0E0E0'>";
}
echo "<td>$tupla[fecha]</td>";
echo "<td>$tupla[nombre]</td>";
echo "<td align=\"right\">$tupla[nombrecur]</td>";
echo "<td align=\"right\">$tupla[alumnos]</td>";
echo "<td align=\"right\">$tupla[nombrecur]</td>";
echo "<td align=\"right\">$tupla[netofact]</td>";
echo "<td align=\"right\">$tupla[rapel]</td>";
echo "<td></td>";
echo "</tr>";
$conta=$conta+1;
$matrizfac[$conta]=$tupla[id_factura];
}
}
$_SESSION['mfacturas']=$matrizfac;
echo "<a href='../fracomernologo.php' target='_blank'> Generar Todos </a> ";
?>


untitled.php

<?php
session_start () ;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title><strong>Facturación</title>
<style type="text/css">
<!--
.jqm1 {
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.jqm2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.jqm3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: lighter;
font-size: 11px;
}
.jqm4 {font-size: 9px}
.jqm5 {font-size: 11px}
-->

</style>
<STYLE>
H1.SaltoDePagina
{
PAGE-BREAK-AFTER: always
}
.Estilo8 {color: #FFFFFF; font-weight: bold; }
</STYLE>
</head>
<script language="javascript" src="cal2.js" type="text/javascript"></script>
<script language="javascript" src="cal_conf2.js" type="text/javascript" ></script>

<body>

<p>
<?php
$comercial=$_POST['comercial'];
$f_inicio=$_POST['f_inicio'];
$f_fin=$_POST['f_fin'];
include "encabezado.php";
$time = time();
$ejercicio=date(Y);
//$ejercicio=2009;
$sql = "SELECT * FROM cur09";
if (($f_inicio!="")and(f_fin!="")){
$sql .=" WHERE fecha BETWEEN '$f_inicio' AND '$f_fin' and comercial='$comercial'";
}
$re= mysql_query($sql);

?>
<p> <strong>FACTURACIÓN COMERCIAL: <? echo "$comercial";?></strong>
</p>
<table width="85%" bgcolor='#CCCCCC' border="4">
<tr>
<td bordercolor="#333333"><form name="sampleform" method="post" action="">
<table width="99%" border="0">
<tr>
<td width="13%"><strong>Comercial</strong></td>
<td colspan="3"><select name="comercial">
<option>Todos</option>
<?php
$sqlcomer ="SELECT * FROM comerciales";
$recomer= mysql_query($sqlcomer);
while ($tuplacomer = mysql_fetch_assoc($recomer)){
echo "<option value='$tuplacomer[id_comercial]'>$tuplacomer[id_comercial] - $tuplacomer[ciudad]</option>";
}

?>
</select>



</select></td></tr>
<? $f_inicio=date('Y-m-d');
$f_fin=date('Y-m-d'); ?>
&nbsp;</td>
<td width="20%">&nbsp;</td>
</tr>
<tr>
<td><strong>Periodo</strong></td>
<td width="28%"><input type="text" name="f_inicio" value="<? echo "$f_inicio";?>"size="12" maxlength="10"/>
</td>
<td width="7%"><em><strong>al</strong></em></td>
<td width="32%"><input type="text" name="f_fin" value="<? echo "$f_fin";?>"size="12" maxlength="10"/>
<td><strong>Ejercicio</strong></td> </td><td width="32%"><input type="text" name="ejercicio" size="12" maxlength="10"/></td>
<td><input type="submit" name="busqueda" value=" Buscar " class="jqm2"/></td>
</tr>
</table>
</form></td>
</tr>
</table>
<br />
<tr>
<td bordercolor="#333333"><form action="imprsinlogo.php" method="post"/>

<table width="99%" border="1" cellpadding="3" cellspacing="3">
<?php
if(isset($_POST['busqueda'])){
include("funciones/buscar.php");
}else{
echo "<span class='Estilo1'></span>";
}
?>

</table>
</form>

<?
mysql_free_result($re);
?>



</table>
</form>

<H1 class=SaltoDePagina> </H1>
</body>
</html>

Si me puedieran echar una mano seria un respiro, gracias