Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/04/2010, 12:41
Avatar de HiToGoRoShi
HiToGoRoShi
 
Fecha de Ingreso: abril-2008
Mensajes: 849
Antigüedad: 16 años, 11 meses
Puntos: 31
Respuesta: Ejeccutar script de mysql ?

Para ejecutar el script hago esto:

Código PHP:
Ver original
  1. $mees = file_get_contents("db/mees.sql");
  2.             mysql_query("source $mees") or die (mysql_error());
  3.             header("Location: index.php");

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source -- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -' at line 1

El error que vota:

Este es el script de MySQL

Código SQL:
Ver original
  1. -- phpMyAdmin SQL Dump
  2. -- version 3.2.4
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Servidor: localhost
  6. -- Tiempo de generación: 04-04-2010 a las 00:21:16
  7. -- Versión del servidor: 5.1.41
  8. -- Versión de PHP: 5.3.1
  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: `mees`
  20. --
  21. CREATE DATABASE `mees` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
  22. USE `mees`;
  23.  
  24. -- --------------------------------------------------------
  25.  
  26. --
  27. -- Estructura de tabla para la tabla `mess_usuario`
  28. --
  29.  
  30. CREATE TABLE IF NOT EXISTS `mess_usuario` (
  31.   `id` INT(10) NOT NULL AUTO_INCREMENT,
  32.   `username` VARCHAR(20) NOT NULL,
  33.   `password` VARCHAR(20) DEFAULT NULL,
  34.   `correo` VARCHAR(50) DEFAULT NULL,
  35.   `rango` CHAR(1) DEFAULT NULL,
  36.   PRIMARY KEY (`id`)
  37. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  38.  
  39. --
  40. -- Volcar la base de datos para la tabla `mess_usuario`
  41. --
  42.  
  43.  
  44. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  45. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  46. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;