PageRenderTime 55ms CodeModel.GetById 52ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/install_mysql/installation.php

http://gespac.googlecode.com/
PHP | 28 lines | 22 code | 6 blank | 0 comment | 3 complexity | f98660c780e2cac2a62e99e8769ee603 MD5 | raw file
 1<?php
 2	echo '<center>';
 3	echo 'Mise en place de la nouvelle base GESPAC<br>';
 4
 5	require_once ('../gespac/config/databases.php');
 6	$ressource = mysql_pconnect($host, $user, $pass) or trigger_error(mysql_error(),E_USER_ERROR); 
 7	
 8 	mysql_select_db($gespac, $ressource);
 9 
10 
11	$requetes="";
12 
13	$sql=file("base_gespac.sql"); // on charge le fichier SQL
14	foreach($sql as $l){ 
15		if (substr(trim($l),0,2)!="--"){
16			$requetes .= $l;
17		}
18	}
19 
20	$reqs = explode(";",$requetes);// on sépare les requętes
21	foreach($reqs as $req){	// et on les éxécute
22		if (!mysql_query($req,$ressource) && trim($req)!=""){
23			die("ERROR : ".$req); // stop si erreur 
24		}
25	}
26echo "base install&eacute;e<br>
27<a href='fin_install.php'>Retour</a>";
28?>