If it helps, after posting this question, I did some searching, and I found an 
installation script which creates a database and creates the tables using pure 
sql statements in a php file. Here's the coding...


PHP Code:
<?php

$dbhost = '*****';
$dbuser = '*****';
$dbpass = '*****';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to 
mysql');

$dbname = '*****';
mysql_select_db($dbname);

// function create_tables() {

  $filename = "core_sql.php";
  $fd = fopen ($filename, "r");
  $sql_data = fread($fd, filesize($filename));
  fclose ($fd);

  preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );

  foreach ($result[0] as $sql_table) {
   preg_match("/CREATE TABLE\s(.*?)\s\(/si", $sql_table, $match);
   $tablename = $match[1];
   preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
   $sql_table = preg_replace("/create table\s/si", "CREATE TABLE test_", 
$sql_table);
  }
?>
The file core_sql.php is a php file which opens and closes the PHP tags, and 
then underneath is just sql statements you would use on a MySQL command line. 
So this has to be possible. But the coding I have posted, I don't understand 
it. And it doesn't work for me. Perhaps someone can see something there that is 
not right. It was mostly built up of variables contained in the installation 
script but I manadged to "translate" most of it!


Arena Servers - Web Hosting
http://www.arenasmithster.co.uk

Reply via email to