Вопрос

SQL:

create table autori(
   id_autor integer primary key auto_increment,
   nume varchar(50) not null,
   prenume varchar(50) not null
)Engine=InnoDB;

create table domenii(
   id_domeniu integer primary key auto_increment,
   nume_domeniu varchar(50) not null,
   descriere varchar(1000) not null
)Engine=InnoDB;

PHP:

$sqlpath = "file.sql";
$sqlfile = fopen($sqlpath, 'r');
$sql = fread($sqlfile, filesize($sqlpath));
fclose($sqlfile);

$result = mysql_query($sql);

Когда я выполняю сценарий, показываю:

У вас есть ошибка в вашем синтаксисе SQL; Проверьте руководство, которое соответствует вашей версии MySQL Server для правого синтаксиса для использования вблизи 'Create Table Domenii (id_domeniu Integer Primary Key Auto_increment, nume_domeniu' в строке 2

MySQL версия 5.0.51a. Немного помощи?

Спасибо.

Это было полезно?

Решение

mysql_query() может запускать только один запрос за раз.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top