Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/05/2013, 09:54
drenag
 
Fecha de Ingreso: mayo-2013
Mensajes: 13
Antigüedad: 11 años, 9 meses
Puntos: 0
Respuesta: MySQL ha devuelto un conjunto de valores vacío

Ok lo subo otra vez:

Archivos PHP:

registro.php

Código PHP:
Ver original
  1. <html>
  2.     <head>
  3.         <title>Registro de usuario</title>
  4.  
  5.     </head>
  6.    
  7.     <body>
  8.         <h1>Registro usuario</h1>
  9.         <h3>Los campos con (*) son obligados.</h3>
  10.        
  11.         <form method="POST" action="registro2.php">
  12.  
  13.             <table>
  14.                
  15.                 <tr>
  16.                     <td>
  17.  
  18.                         *Nombre y apellidos:
  19.  
  20.                     </td>
  21.                     <td>
  22.  
  23.                     <input type="text" name="realname"/>
  24.                     </td>
  25.                
  26.                 </tr>
  27.  
  28.                 <tr>
  29.                     <td>
  30.  
  31.                         *Contraseña:
  32.  
  33.                     </td>
  34.                     <td>
  35.  
  36.                     <input type="password" name="clave"/>
  37.                     </td>
  38.                
  39.                 </tr>
  40.                
  41.                         <tr>
  42.                     <td>
  43.  
  44.                         *Repetir Contraseña:
  45.  
  46.                     </td>
  47.                     <td>
  48.  
  49.                     <input type="password" name="rclave"/>
  50.                     </td>
  51.                
  52.                 </tr>
  53.                
  54.                
  55.                 <tr>
  56.                     <td>
  57.  
  58.                         Correo eléctrónico:
  59.  
  60.                     </td>
  61.                     <td>
  62.  
  63.                     <input type="text" name="correo"/>
  64.                     </td>
  65.                
  66.                 </tr>
  67.                
  68.                
  69.  
  70.             </table>
  71.             <input type="submit" name="submit" value="Registrarme"/> <input type="reset"/>
  72.     </form>
  73.  
  74.    
  75.    
  76.     </body>
  77. </html>


registro2.php

Código PHP:
Ver original
  1. <?php
  2.     $realname = $_POST ['realname'];
  3.     $clave = $_POST ['clave'];
  4.     $rclave = $_POST ['rclave'];
  5.     $correo = $_POST ['correo'];
  6.  
  7.     $reqlen=strlen($realname) * strlen($clave) * strlen($rclave);
  8.  
  9.     if($reqlen > 0){
  10.        
  11.         if($clave == $rclave){
  12.             require("connect_db.php");
  13.             $clave= md5($clave);
  14.            
  15.             //$sql= "INSERT INTO formulario (Nombre, Clave, Correo)  VALUES (" . $realname ." , " . $clave . ", " .$correo . ")";
  16.            
  17.             $sql= "INSERT INTO formulario (Nombre, Clave, Correo) VALUES ('" . $realname ."' , '" . $clave . "', '" .$correo . "')";
  18.         } else {
  19.  
  20.             echo 'Debe introducir dos contraseñas identicas';
  21.  
  22.         }
  23.    
  24.     } else {
  25.        
  26.         echo 'Por favor, rellene todos los campos requeridos';
  27.    
  28.     }
  29. ?>
  30. ?>

Base de datos:

TAKECAREtakecareEXPORT.sql

Código SQL:
Ver original
  1. -- phpMyAdmin SQL Dump
  2. -- version 3.3.9
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Servidor: localhost
  6. -- Tiempo de generación: 24-05-2013 a las 12:23:45
  7. -- Versión del servidor: 5.5.8
  8. -- Versión de PHP: 5.3.5
  9.  
  10. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  11.  
  12.  
  13. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  14. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  15. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  16. /*!40101 SET NAMES utf8 */;
  17.  
  18. --
  19. -- Base de datos: `takecare`
  20. --
  21.  
  22. -- --------------------------------------------------------
  23.  
  24. --
  25. -- Estructura de tabla para la tabla `formulario`
  26. --
  27.  
  28. DROP TABLE IF EXISTS `formulario`;
  29. CREATE TABLE IF NOT EXISTS `formulario` (
  30.   `idForm` INT(10) NOT NULL AUTO_INCREMENT,
  31.   `Nombre` VARCHAR(30) NOT NULL,
  32.   `Clave` VARCHAR(15) NOT NULL,
  33.   `Correo` VARCHAR(30) NOT NULL,
  34.   PRIMARY KEY (`idForm`)
  35. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  36.  
  37. --
  38. -- Volcar la base de datos para la tabla `formulario`
  39. --

Aquí lo tienes la linea que me comentaste que estaba mal esta comentada // he hecho la corrección con las comillas que me dijiste debajo de la que tenia mal.