Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/11/2008, 17:03
Avatar de juaniquillo
juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 5 meses
Puntos: 281
Respuesta: error: headers already sent

Intenta quitando el extra tag php de arriba

Código php:
Ver original
  1. <?php virtual('/sitiophp/Connections/conexcurso.php');
  2.  
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5. $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  6.  
  7. switch ($theType) {
  8. case "text":
  9. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  10. break;
  11. case "long":
  12. case "int":
  13. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  14. break;
  15. case "double":
  16. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  17. break;
  18. case "date":
  19. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  20. break;
  21. case "defined":
  22. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  23. break;
  24. }
  25. return $theValue;
  26. }
  27.  
  28. $editFormAction = $_SERVER['PHP_SELF'];
  29. if (isset($_SERVER['QUERY_STRING'])) {
  30. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  31. }
  32.  
  33. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  34. $insertSQL = sprintf("INSERT INTO alumnos (codigo, nombre, apellidos, nif) VALUES (%s, %s, %s, %s)",
  35. GetSQLValueString($_POST['codigo'], "text"),
  36. GetSQLValueString($_POST['nombre'], "text"),
  37. GetSQLValueString($_POST['apellidos'], "text"),
  38. GetSQLValueString($_POST['nif'], "text"));
  39.  
  40. mysql_select_db($database_conexcurso, $conexcurso);
  41. $Result1 = mysql_query($insertSQL, $conexcurso) or die(mysql_error());
  42.  
  43. $insertGoTo = "/sitiophp/insertOK.php";
  44. if (isset($_SERVER['QUERY_STRING'])) {
  45. $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  46. $insertGoTo .= $_SERVER['QUERY_STRING'];
  47. }
  48. header(sprintf("Location: %s", $insertGoTo));
  49. }
  50.  
  51. mysql_select_db($database_conexcurso, $conexcurso);
  52. $query_rsalumnos = "SELECT * FROM alumnos";
  53. $rsalumnos = mysql_query($query_rsalumnos, $conexcurso) or die(mysql_error());
  54. $row_rsalumnos = mysql_fetch_assoc($rsalumnos);
  55. $totalRows_rsalumnos = mysql_num_rows($rsalumnos);
  56. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  57. <html xmlns="http://www.w3.org/1999/xhtml">
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  60. <title>Documento sin t&iacute;tulo</title>
  61. </head>
  62.  
  63. <body>
  64. <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  65. <table align="center">
  66. <tr valign="baseline">
  67. <td nowrap align="right">Codigo:</td>
  68. <td><input type="text" name="codigo" value="" size="32"></td>
  69. </tr>
  70. <tr valign="baseline">
  71. <td nowrap align="right">Nombre:</td>
  72. <td><input type="text" name="nombre" value="" size="32"></td>
  73. </tr>
  74. <tr valign="baseline">
  75. <td nowrap align="right">Apellidos:</td>
  76. <td><input type="text" name="apellidos" value="" size="32"></td>
  77. </tr>
  78. <tr valign="baseline">
  79. <td nowrap align="right">Nif:</td>
  80. <td><input type="text" name="nif" value="" size="32"></td>
  81. </tr>
  82. <tr valign="baseline">
  83. <td nowrap align="right">&nbsp;</td>
  84. <td><input type="submit" value="Insertar registro"></td>
  85. </tr>
  86. </table>
  87. <input type="hidden" name="MM_insert" value="form1">
  88. </form>
  89. <p>&nbsp;</p>
  90. </body>
  91. </html>
  92. <?php
  93. mysql_free_result($rsalumnos);
  94. ?>

Aunque yo no vi ningún espacio ahí.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...