What im trying to do is simple, but not working.
I got a script( script.sql )
Which contains statement to create table :
create table table1 ( ... )
create table table2 ( ... )
create table table3 ( ... )
From a function in a php class
I read this file
$fileSize = filesize("script.sql");
$fp = fopen("script.sql", "r" );
$queryStr = fread( $fp, $fileSize );
Then I try to execute the queryStr
mysql_db_query("dbName", $queryStr);
But it always says query failed.
Is there any other way to run a script
from php
btw the scripts works fine is I do it
from the console
mysql -h host -u root dbName -p > script.sql