Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/09/2013, 14:26
manolilorenzo
 
Fecha de Ingreso: agosto-2013
Ubicación: cadiz
Mensajes: 35
Antigüedad: 10 años, 8 meses
Puntos: 0
Respuesta: error al insertar registro

Cita:
Iniciado por jonni09lo Ver Mensaje
El echo te debería mostrar el pantalla el resultado, después de haber hecho el registro...

Saludos
Lo intento pero no muestra nada asi deberia quedar no ?
Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO descargas (idaudiolibro, enlace, usuario, valoracion, fallo) VALUES (%s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['idaudiolibro'], "text"),
                       
GetSQLValueString($_POST['enlace'], "text"),
                       
GetSQLValueString($_POST['usuario'], "text"),
                       
GetSQLValueString($_POST['valoracion'], "text"),
                       
GetSQLValueString($_POST['fallo'], "text"));

  
mysql_select_db($database_audiolibro$audiolibro);
  
$Result1 mysql_query($insertSQL$audiolibro) or die(mysql_error());

  
$insertGoTo "nuevo-enlace.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
  echo 
sprintf("Location: %s"$insertGoTo);
}
?>