Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/05/2015, 02:47
mortisdj
 
Fecha de Ingreso: mayo-2014
Ubicación: Valencia
Mensajes: 63
Antigüedad: 9 años, 11 meses
Puntos: 0
Query was empty

Buenas, a ver si alguien me puede ayudar, ya que estoy pez con el PHP. He hecho un formulario para agregar distribuidores a mi base de datos y a la hora de intentar rellenar el formulario me devuelve un "Query was empty".

Este es el código:

Código PHP:
<?php require_once('Connections/conexion.php'); ?>
<?php 
require_once('includes/funciones.php'); ?>
<?php 
if(isset( $_SESSION['MM_UserGroup']) &&  $_SESSION['MM_UserGroup']==1){?>
<?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_update"])) && ($_POST["MM_update"] == "form2")) {
  
$updateSQL sprintf("UPDATE tbldistribuidores SET disNomEmp=%s, disActiEmp=%s, disNomCon=%s, disApelCon=%s, disTelefono=%s, disMovil=%s, disEmail=%s, disNotas=%s WHERE intId=%s",
                       
GetSQLValueString($_POST['disNomEmp'], "text"),
                       
GetSQLValueString($_POST['disActiEmp'], "text"),
                       
GetSQLValueString($_POST['disNomCon'], "text"),
                       
GetSQLValueString($_POST['disApelCon'], "text"),                  
                       
GetSQLValueString($_POST['disTelefono'], "int"),
                       
GetSQLValueString($_POST['disMovil'], "int"),
                       
GetSQLValueString($_POST['disEmail'], "text"),
                       
GetSQLValueString($_POST['disNotas'], "text"));

  
mysql_select_db($database_conexion$conexion);
  
$Result1 mysql_query($updateSQL$conexion) or die(mysql_error());

  
$updateGoTo "distribuidores-list.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}


$UsuarioId_ModificarDatos "0";
if (isset(
$_GET['recordId'])) {
  
$UsuarioId_ModificarDatos $_GET['recordId'];
}
mysql_select_db($database_conexion$conexion);
$query_ModificarDatos sprintf("SELECT * FROM tbldistribuidores WHERE tbldistribuidores.intId= %s"GetSQLValueString($UsuarioId_ModificarDatos"int"));
$ModificarDatos mysql_query($query_ModificarDatos$conexion) or die(mysql_error());
$row_ModificarDatos mysql_fetch_assoc($ModificarDatos);
$totalRows_ModificarDatos mysql_num_rows($ModificarDatos);

?>
<!DOCTYPE html>
<html lang="es"><!-- InstanceBegin template="/Templates/Principal.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Prueba.es</title>
<meta name="description" content="">
<meta name="robots" content="index, follow">
<!-- InstanceEndEditable -->
<meta charset="utf-8">
<?php include("includes/precabecera.php"); ?>

<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<!-- InstanceBeginEditable name="EditRegion3" -->
<?php $menuseleccionado 6;?>
<section class="bg1">
  <!--==============================header=================================-->
  <header id="header">
    <div class="container_12">
      <?php include("includes/cabecera.php"); ?>
      <?php //include("includes/slider.php"); ?>
      <?php include("includes/menu.php"); ?>
    </div>
  </header>
  <!--===================content====================-->
  <div id="content">
    <div class="container_12">
        <div class="row">
 
            <div class="prefix_4 grid_6">
            <?php if (  isset($_GET['recordtext']) && $_GET['recordtext']=='1'){ ?>
            <br><br><div  class="mensajeenviado">Mensaje Guardado Correctamente</div>
            <?php }?>
              <h3 class="mrg22 pad3">Editar datos de: <?php echo $_GET['recordNameUser']; ?></h3>        
             
    <form method="POST" action="<?php echo $editFormAction?>" name="form2">    
                    <label class="name">
                      <h1>Nombre: </h1>
                      <input id="nombreempresa" name="disNomEmp"  class="seleccion" type="text" value="<?php echo htmlentities($row_ModificarDatos['disNomEmp'], ENT_COMPAT'utf-8'); ?>" onClick="javascript:  borrarnombreempresa();"/>
           
                      <div id="errorregistronombreempresa" class="ocultar texto-error">* Campo obligatorio</div>                        
                    </label>
                     <label class="name">
                          <br><br><h1>Actividad:</h1>
                          <input id="actividad" name="disActiEmp"  class="seleccion" type="text"  value="<?php echo htmlentities($row_ModificarDatos['disActiEmp'], ENT_COMPAT'utf-8'); ?>"  onClick="javascript:  borraraactividad();"/>
                           
                    <div id="errorregistroactividad" class="ocultar texto-error">* Campo obligatorio</div>
                    </label>
                    <label class="name">
                          <br><br><h1>Nombre:</h1>
                          <input id="nombre" name="disNomEmp"  class="seleccion" type="text"  value="<?php echo htmlentities($row_ModificarDatos['disNomEmp'], ENT_COMPAT'utf-8'); ?>"  onClick="javascript:  borrarnombre();"/>
                           
                    <div id="errorregistronombre" class="ocultar texto-error">* Campo obligatorio</div>
                    </label>
                    <label class="name">
                          <br><br><h1>Apellidos:</h1>
                          <input id="actividad" name="disApelEmp"  class="seleccion" type="text"  value="<?php echo htmlentities($row_ModificarDatos['disApelEmp'], ENT_COMPAT'utf-8'); ?>"  onClick="javascript:  borrarapellidos();"/>
                           
                    <div id="errorregistroapellidos" class="ocultar texto-error">* Campo obligatorio</div>
                    </label>
                    <label class="phone">
                        <br><br><h1>Teléfono:</h1><input id="telefonoregistro" name="disTelefono"  class="seleccion" type="text" value="<?php echo htmlentities($row_ModificarDatos['disTelefono'], ENT_COMPAT'utf-8'); ?>" onClick="javascript:  borrartelefono();"  />
                    <div id="errorregistrotelefono" class="ocultar texto-error">* Debe ser un Teléfono válido</div>
                    </label>
                    <label class="phone">
                        <br><br><h1>Móvil:</h1><input id="telefonoregistro" name="disMovil"  class="seleccion" type="text" value="<?php echo htmlentities($row_ModificarDatos['disMovil'], ENT_COMPAT'utf-8'); ?>" onClick="javascript:  borrartelefono();"  />
                    <div id="errorregistrotelefono" class="ocultar texto-error">* Debe ser un Teléfono válido</div>
                    </label>
                    <label class="email">
                      <br><br><h1>Email:</h1><input id="emailregistro" name="disEmail"  disabled class="seleccion" type="text" value="<?php echo htmlentities($row_ModificarDatos['disEmail'], ENT_COMPAT'utf-8'); ?>" />
                    <div id="errorregistroemail" class="ocultar texto-error">* Debe ser un Email válido</div>
                    <div id="errorregistroemailduplicado" class="ocultar texto-error">* Esta dirección de correo ya está siendo usada por un usuario</div>
                    </label>
                    <label class="phone">
                    <label class="message">
                      <br><br><h1>Notas:</h1><textarea id="mensajeregistro" class="seleccionarea" rows="5" name="disNotas" onClick="javascript:  borrarmensaje();" ><?php echo htmlentities($row_ModificarDatos['disNotas'], ENT_COMPAT'utf-8'); ?></textarea>
<div id="errorregistromensaje" class="ocultar texto-error">* Debe escribir un Mensaje</div>
                    </label>
                    <div>
                        <div class="clear"></div>
                        <div class="btns">