views:

34

answers:

1

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);

When I execute the script it show:

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 'create table domenii(id_domeniu integer primary key auto_increment, nume_domeniu' at line 2

Mysql version is 5.0.51a. Some help?

Thanks.

+2  A: 

mysql_query() can only run a single query at a time.

Ignacio Vazquez-Abrams