Foros del Web » Programando para Internet » PHP »

Problemas par trabajar con SESSION

Estas en el tema de Problemas par trabajar con SESSION en el foro de PHP en Foros del Web. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\siap\jao\conexion.php:15) in C:\xampp\htdocs\siap\OP\listado_empleados.php on line 2 este es el codigo: ...
  #1 (permalink)  
Antiguo 25/08/2008, 11:05
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Exclamación Problemas par trabajar con SESSION

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\siap\jao\conexion.php:15) in C:\xampp\htdocs\siap\OP\listado_empleados.php on line 2


este es el codigo:

Código PHP:
<?php include ("../jao/conexion.php");?>
<?php session_start
();?>

<?php




$currentPage 
$_SERVER["PHP_SELF"];
$maxRows_productos 10;
$pageNum_productos 0;
if (isset(
$_GET['pageNum_productos'])) {
  
$pageNum_productos $_GET['pageNum_productos'];
}
$startRow_productos $pageNum_productos $maxRows_productos;

//mysql_select_db($database_rayitaBD, $rayitaBD); codigo Antiguo
mysql_select_db($database$conexion);//Nuevo 
$query_productos "SELECT Id_Empleado,Nombre,Rut,Apellido FROM tblempleados";
$query_limit_productos sprintf("%s LIMIT %d, %d"$query_productos$startRow_productos$maxRows_productos);
$productos mysql_query($query_limit_productos$conexion) or die(mysql_error());
$row_productos mysql_fetch_assoc($productos);

if (isset(
$_GET['totalRows_productos'])) {
  
$totalRows_productos $_GET['totalRows_productos'];
} else {
  
$all_productos mysql_query($query_productos);
  
$totalRows_productos mysql_num_rows($all_productos);
}
$totalPages_productos ceil($totalRows_productos/$maxRows_productos)-1;

$queryString_productos "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_productos") == false && 
        
stristr($param"totalRows_productos") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_productos "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_productos sprintf("&totalRows_productos=%d%s"$totalRows_productos$queryString_productos);
?>






<!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>Documento sin t&iacute;tulo</title>
<link href="../css/siap.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="estilo1" id="Menu">
  <table width="164" border="0" align="right" cellpadding="0" cellspacing="0" class="estilo1">
    <tr>
      <td width="15"><img src="../imag/24x24/001_20.png" alt="Home" width="24" height="24" longdesc="Home" />Home</td>
      <td width="15" align="left" valign="baseline">&nbsp;</td>
      <td width="15"><img src="../imag/24x24/001_06.png" width="24" height="24" />Informe</td>
      <td width="15">&nbsp;</td>
      <td width="15"><img src="../imag/24x24/001_55.png" width="24" height="24" /></td>
      <td width="15"><? echo $_SESSION['usuario_login'?></td>
      <td width="74">&nbsp;</td>
    </tr>
  </table>
</div>
<p>&nbsp;</p>
<div id="contenidos">
  <table width="100%"  border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
    <!--DWLayoutTable-->
    <tr align="center">
      <td colspan="3"><?php if ($pageNum_productos 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_productos=%d%s"$currentPagemax(0$pageNum_productos 1), $queryString_productos); ?>">anterior</a>
          <?php // Show if not first page ?>
          <?php echo ($startRow_productos 1?> a <?php echo min($startRow_productos $maxRows_productos$totalRows_productos?> de <?php echo $totalRows_productos ?>
          <?php if ($pageNum_productos $totalPages_productos) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_productos=%d%s"$currentPagemin($totalPages_productos$pageNum_productos 1), $queryString_productos); ?>">siguiente</a>
          <?php // Show if not last page ?>
      </td>
    </tr>
    <?php do { ?>
    <tr valign="top">
      <td width="1%"><img src="../imag/24x24/001_47.png" width="24" height="24" hspace="5" /></td>
      <td width="50%"><b><a href="producto.php?Id_Empleado=<?php echo $row_productos['Id_Empleado']; ?>"><?php echo $row_productos['Nombre']; ?></a></b><br />
          <i><?php echo $row_productos['Apellido']; ?><?php echo $row_productos['Rut']; ?></i> </td>
      <td>$<?php echo number_format($row_productos['precio'],0); ?></td>
    </tr>
    <?php } while ($row_productos mysql_fetch_assoc($productos)); ?>
    <tr>
      <td height="4" colspan="3"></td>
    </tr>
  </table>
</div>

<p>
  <?php //include("menu.php"); ?>
</p>
<p>&nbsp;</p>
</body>
</html>
  #2 (permalink)  
Antiguo 25/08/2008, 12:50
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Problemas par trabajar con SESSION

Pon el session_start al PRINCIPIO de tu codigo. Justo antes de cualquier otra cosa, como el include que tiene alli.
  #3 (permalink)  
Antiguo 25/08/2008, 13:42
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Problemas par trabajar con SESSION

Lo e puesto como tu me dices pero no me carga nada en<? echo $_SESSION['usuario_login'] ?> no me muestra el nombre del usuario logeado


  #4 (permalink)  
Antiguo 25/08/2008, 13:48
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Problemas par trabajar con SESSION

Cita:
Iniciado por a83 Ver Mensaje
Lo e puesto como tu me dices pero no me carga nada en<? echo $_SESSION['usuario_login'] ?> no me muestra el nombre del usuario logeado
:P hmmm, pon las etiquetas completas. <?php
en caso de que en tu php.ini no esten habilitadas las short tags.

Tambien ten cuidado si hay algun session_destroy por algun lado.

Última edición por Ronruby; 25/08/2008 a las 14:07
  #5 (permalink)  
Antiguo 25/08/2008, 15:25
(Desactivado)
 
Fecha de Ingreso: agosto-2008
Mensajes: 23
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: Problemas par trabajar con SESSION

Ya viste estos videos, son muy buenos, te vulves un experto en el tema.

http://tiendaonline.100webspace.net/product_info.php?products_id=30

Te los recomiendo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:20.