Re: PHP Script to Run SQL file
| From: | Chris | Date: | Mon, 30 Jul 2007 00:37:13 +0000 |
| Subject: | Re: PHP Script to Run SQL file | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43869@lists.php.net to get a copy of this message | ||
Arena Servers wrote:
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 mysql_connect(....); $queries = array(); $queries[] = 'create table abc(a int)'; $queries[] = 'create table def(a int, b text)'; foreach ($queries as $query) { $result = mysql_query($query); if (!$result) {
echo 'Unable to run query ' . $query . ': ' . mysql_error() . '<br/>';
exit;
}
}
--
Postgresql & php tutorials
http://www.designmagick.com/