Ver Mensaje Individual
  #21 (permalink)  
Antiguo 03/12/2015, 09:22
ingridquevedoa
 
Fecha de Ingreso: noviembre-2015
Mensajes: 21
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Column 'usuario' cannot be null

Hola,
Estuve revisando y encontre la tabla que menciona el error dataTables warning (table id= 'example'): Requested unknow parameter '8' from the data source for row 0

este es el codigo
Código PHP:
if (isset($_SESSION['usuario'])){
     if($row_user['nombre']==NULL){
     header('Location: login.php');
     }else{
     }
}else{
      header('Location: login.php');
}
      ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Grupos - Contratos</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #EAEAEA;
}
-->
</style>
<link href="../../css/clases.css" rel="stylesheet" type="text/css" />
<link href="../../css/evo_mew.css" rel="stylesheet" type="text/css" />
<link href="../../css/styles_new.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {color: #FFFFFF; }
a:link {
    color: #FF0000;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #FF0000;
}
a:hover {
    text-decoration: underline;
    color: #FF0000;
}
a:active {
    text-decoration: none;
    color: #FF0000;
}
-->
</style>

<style type="text/css" title="currentStyle">
            @import "media/css/demo_page.css";
            @import "media/css/jquery.dataTables.css";
        </style>
        <script type="text/javascript" language="javascript" src="media/js/jquery.js"></script>
        <script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>
        <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                $('#example').dataTable();
            } );
        </script>
        <script src="../../js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript" charset="utf-8">
  $(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
  });
</script>
<script language="JavaScript">
function pregunta(){
    return confirm('¿Estas seguro de borrar este contrato y todos sus adjuntos?'); 
}
</script> 
</head>

<body>
<?PHP 
if($row_user['tipo']==1){?>
<table width="1100" border="0" align="center">
  <tr>
    <td><table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="1100">
      <thead>
        <tr>
          <th colspan="2">[<a href="agregar_contratosg.php">Agregar Contrato</a>]</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
          <th>&nbsp;</th>
        </tr>
        <tr>
          <th >Codigo</th>
          <th >Nombre_compa&ntilde;ia</th>
          <th >Fecha_Inicio</th>
          <th>Observaciones</th>
          <th>Hotel</th>
          <th>Modificar</th>
          <th>Adjuntos</th>
          <th>Eliminar</th>
        </tr>
      </thead>
      <tbody>
        <?php do { ?>
            <?php if ($totalRows_contratos 0) {// Show if recordset not empty ?>
            
  <tr class="odd gradeX">
    <td class="center"><?php echo $row_contratos['codigo']; ?></td>
    <td class="center"><?php echo $row_contratos['compania']; ?></td>
    <td class="center"><?php echo $row_contratos['fecha_inicio']; ?></td>
    <td class="center"><?php echo $row_contratos['observaciones']; ?></td>
    <td class="center"><?php echo $row_contratos['hotel']; ?></td>
    
 
    <td class="center"><a href="modificar_contratog.php?insert=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.0&id=<?php echo $row_contratos['codigo']; ?>&ola=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187"><img src="../../images/icon/icono_cambiar_clave.gif" width="32" height="32" border="0"></a></td>
    <td class="center"><a href="adjuntosg.php?insert=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.0&id_contrato=<?php echo $row_contratos['codigo']; ?>&ola=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187"><img src="../../images/icon/ampliacion_digitalizacion.png" width="32" border="0"></a></td>
    <td class="center"><form id="form1" name="form1" method="post" action="borrar_contratosg.php" ONSUBMIT="return pregunta();">
      <input name="codigo" type="hidden" id="codigo" value="<?php echo $row_contratos['codigo']; ?>">
      <input name="image" type=image  src="../../img/icons/fail.gif" width="16" height="16" />
    </form></td>
  </tr>
  <?php // Show if recordset not empty ?>
<?php 
} while ($row_contratos mysql_fetch_assoc($contratos)); ?>
      </tbody>
      <tfoot>
      </tfoot>
    </table></td>
  </tr>
</table>
<?PHP 
}else{?>
<table width="1100" border="0" align="center">
  <tr>
    <td><table cellpadding="0" cellspacing="0" border="0" class="display" id="example2" width="1100">
      <thead>
        <tr>
          <th colspan="2">[<a href="agregar_contratosg.php">Agregar Contrato</a>]</th>
          
        </tr>
        <tr>
          <th width="151">Codigo</th>
          <th width="206">Nombre compa&ntilde;ia</th>
          <th>Fecha</th>
          <th>Observaciones</th>
          <th>Hotel</th>
          <th>Modificar</th>
          <th>Adjuntos</th>
        </tr>
      </thead>
      <tbody>
        <?php do { ?>
        <?php if ($totalRows_contratos 0) { // Show if recordset not empty ?>
        <tr class="odd gradeX">
          <<td><?php echo $row_contratos['codigo']; ?></td>
          <td><?php echo $row_contratos['compania']; ?></td>
         
          <td class="center"><?php echo $row_contratos['fecha_inicio']; ?></td>
          <td class="center"><?php echo $row_contratos['observaciones']; ?></td>
          <td class="center"><?php echo $row_contratos['hotel']; ?></td>
         
     
          <td class="center"><a href="modificar_contratog.php?insert=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.0&id=<?php echo $row_contratos['codigo']; ?>&ola=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187"><img src="../../images/icon/icono_cambiar_clave.gif" width="32" height="32" border="0"></a></td>
          <td class="center"><a href="adjuntosg.php?insert=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.0&id_contrato=<?php echo $row_contratos['codigo']; ?>&ola=0j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187.9.9.0.0.0.0.178.1044.4j5.9.00j0i30j0i5i30l2.1485.4038.0.4187"><img src="../../images/icon/ampliacion_digitalizacion.png" width="32" border="0"></a></td>
        </tr>
        <?php // Show if recordset not empty ?>
        <?php } while ($row_contratos mysql_fetch_assoc($contratos)); ?>
      </tbody>
      <tfoot>
      </tfoot>
    </table></td>
  </tr>
</table>
<?PHP 
}?>
<p>[<a href="menug.php">Volver</a>]</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result
($contratos);
?>
De acuerdo al error, hay una tabla que se llama example la cual se encuentra en el codigo, en la parte donde dice
Código PHP:
 <?php do { ?>
            <?php if ($totalRows_contratos 0) {// Show if recordset not empty ?>
            
  <tr class="odd gradeX">
    <td class="center"><?php echo $row_contratos['codigo']; ?></td>
    <td class="center"><?php echo $row_contratos['compania']; ?></td>
    <td class="center"><?php echo $row_contratos['fecha_inicio']; ?></td>
    <td class="center"><?php echo $row_contratos['observaciones']; ?></td>
    <td class="center"><?php echo $row_contratos['hotel']; ?></td>
ese 0 que esta después de contratos > lo cambio por un 1, pero al hacer eso, el primer archivo que ingreso al programa, no se observa y al ingresar un segundo archivo ya me aparecen los dos.

No se que debo cambiar,

Gracias