ok... following problem...
im writing my first bigger php/mysql script and need to do the following:
after uploading the files, the script checks if the db is already set up - if NOT (till here it works), then the mysql dump should be "applied" (for the lack of a better word) to the database.
so i pretty much have a dump in a string and want the whole thing to be processed...
the thing is, i got it like that now:
<?php
$link = mysql_connect($dbhost, $dbuser, $dbpw);
$initquery = "CREATE TABLE " . "$prefix" . "starxtest ( id tinyint(4) NOT NULL auto_increment, testname tinytext NOT NULL, PRIMARY KEY (id)) TYPE=MyISAM;";
if (mysql_db_query($dbname, $initquery, $link)) {
mysql_close($testlink);
header("Location:$PHP_SELF");
}
else {
print "database tables could not be created...";
mysql_close($link);
exit();
}
?>
ok - so far so good - this actually DOES work... but now have a closer look at the $initquery variable which holds the query:
as long as it got ONE statement as here it works fine. the thing is: i want it to hold a whole DUMP which - of course consists of a whole lot more than just one statement.
so how can i process this? is there a way to have it split up in array elements and have it processed one by one, or whats the best way to do that...?
what i need is pretty much what f.ex. phpmyadmin does, when you "Run SQL query/queries" on a database
thanks a lot - every help is greatly appreciated...
thanks a lot - sid