From 1c1a0673c3f8e0905425a20a99cb28de1f1532e2 Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 2 Nov 2010 16:24:04 +0000 Subject: [PATCH] Adding conferences_id to the last two tables that need it --- db/db.code.version.txt | 2 +- db/db.update.218.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 db/db.update.218.php diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 0ddd619..dc6f4a8 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -217 +218 diff --git a/db/db.update.218.php b/db/db.update.218.php new file mode 100644 index 0000000..f16e716 --- /dev/null +++ b/db/db.update.218.php @@ -0,0 +1,32 @@ + conference_id links + $q1 = mysql_query("SELECT year, id FROM conferences WHERE year > 0"); + + // add the conferences_id field to each table + while($r = mysql_fetch_assoc($q1)){ + foreach($tables as $tableName){ + $query = "UPDATE `$tableName` SET `conferences_id` = {$r['id']} WHERE `year` = {$r['year']}"; + mysql_query($query); + echo $query . ";\n"; + } + } +} +?>