Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/11/2008, 13:36
Avatar de jotaincubus
jotaincubus
 
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
Problema con INSERT

Buen día para todos y muchas gracias al mago que me pueda ayudar, estoy tratando de hacer un INSERT en MySQL dependiendo de los checkbox que elija el usuario. El problema es que cuando el usuario le da insertar me sale el siguiente error:

Query was empty

pero si inserta algunos campos en la base de datos....

este es el codigo php que hace el INSERT en la base de datos:

Código PHP:
<?php require_once('../Connections/conectar.php'); ?>
<?php

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

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$mail$_GET["m"];
if (
$cult != 0){ 
 
mysql_query ("INSERT INTO usuario_tipo (mail, tipo) VALUES ('$mail', '$cult')");} 
if (
$Depor  != 0){ 
 
mysql_query ("INSERT INTO usuario_tipo (mail, tipo) VALUES ('$mail', '$depor')");}
if (
$educ != 0){ 
 
mysql_query ("INSERT INTO usuario_tipo (mail, tipo) VALUES ('$mail', '$educ')");}
if (
$ofer != 0){ 
 
mysql_query ("INSERT INTO usuario_tipo (mail, tipo) VALUES ('$mail', '$ofer')");}
if (
$cine != 0){ 
 
mysql_query ("INSERT INTO usuario_tipo (mail, tipo) VALUES ('$mail', '$cine')");}


  
mysql_select_db($database_conectar$conectar);
  
$Result1 mysql_query($insertSQL$conectar) or die(mysql_error());

  
$insertGoTo "usr.msj.nuevoexitoso.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
Y este es el codigo del formulario:

Código HTML:
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
     <fieldset id="form_txt">
     <legend><strong>CONFIGURACION DEL PERFIL</strong></legend>
     <p><strong>Paso 2/2</strong></p>
     <p>Por favor seleccione los tipos de evento en los cuales esta interesado en recibir informacion.</p>
  <table id="ValidCheckbox4">
    
    <tr>
      <td><input name="cult" type="checkbox" id="cult" value="1" />
        <label for="cult">Culturales</label></td>
      <td><input name="depor" type="checkbox" id="depor" value="2" />
        <label for="depor">Deportes</label></td>
      <td><input name="educ" type="checkbox" id="educ" value="3" />
        <label for="educ">Educativos</label></td>
    </tr>

    <tr>
      <td><input name="ofer" type="checkbox" id="ofer" value="4" />
        <label for="ofer">Ofertas Comerciales</label></td>
      <td><input name="cine" type="checkbox" id="cine" value="5" />
        <label for="cine">Cine</label>
      </td>
      <td>&nbsp;</td>
    </tr>
    
    <tr>
    </tr>
    
    <tr>
      <td colspan="3" style="width:100%;"><span class="checkboxRequiredMsg">Por favor seleccione al menos una opcion.</span> <span class="checkboxMinSelectionsMsg">Por favor seleccione al menos una opcion.</span> <span class="checkboxMaxSelectionsMsg">EL maximo de eventos seleccionados es de 5</span>&nbsp; </td>
    </tr>
  
  </table>
  <input name="Submit" type="submit" value="Registrarse" id="Submit" />
  </fieldset>
     <input type="hidden" name="MM_insert" value="form1" />
     </form>
<script type="text/javascript">
<!--
var ValidCheckbox4 = new Spry.Widget.ValidationCheckbox("ValidCheckbox4", {minSelections:1, maxSelections:5, validateOn:["submit"]});
//-->
</script> 
Muchisimas gracias a la presona que me pueda ayudar...
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???