Re: PHP Script to Run SQL file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux