projects
/
cl7.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FIX La connexion n'était pas établie lors de la création/mise à jour de la BD.
[cl7.git]
/
php
/
update_db.php
diff --git
a/php/update_db.php
b/php/update_db.php
index
356ba67
..
7f43381
100644
(file)
--- a/
php/update_db.php
+++ b/
php/update_db.php
@@
-4,7
+4,9
@@
* Si des tables n'existes pas elles sont automatiquement créées.
*/
* Si des tables n'existes pas elles sont automatiquement créées.
*/
-include("connexion.php");
+include_once("connexion.php");
+
+$connexion = new Connexion();
function creer_db()
{
function creer_db()
{
@@
-74,7
+76,11
@@
function update_db()
{
# si la table 'config' n'existe pas alors on suppose qu'aucune table n'existe
$version = 0;
{
# si la table 'config' n'existe pas alors on suppose qu'aucune table n'existe
$version = 0;
- if(!$version = (int)@mysql_fetch_object(mysql_query("SELECT valeur FROM config WHERE nom = 'version'")))
+ $res = @mysql_fetch_object(mysql_query("SELECT valeur FROM config WHERE nom = 'version'"));
+ if (!mysql_error())
+ $version = $res->valeur;
+
+ if($version == 0)
{
mysql_query("BEGIN TRANSACTION");
creer_db();
{
mysql_query("BEGIN TRANSACTION");
creer_db();