Mercurial > hg > extraction-interface
comparison models/home.php @ 47:886f43b26ee2 extractapp
move/remove develop folder
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 17 Mar 2015 10:54:13 +0100 |
parents | |
children | 840cdb52f476 |
comparison
equal
deleted
inserted
replaced
46:b3ca5d2b4d3f | 47:886f43b26ee2 |
---|---|
1 <?php | |
2 | |
3 class HomeModel { | |
4 public function Index() { | |
5 return array("Index Value 1", "Value 2", "Value 3"); | |
6 } | |
7 | |
8 public function Test() { | |
9 | |
10 /* uncomment to do the merge | |
11 // merge books table with books_info table | |
12 $query = "SELECT books_info.volume, books_info.author, books_info.edition, books_info.books_id FROM books INNER JOIN books_info ON books.id=books_info.books_id"; | |
13 | |
14 $result = mysql_query($query); | |
15 if (!$result) { | |
16 return json_encode("Failed during selecting books, books_info table."); | |
17 } | |
18 $query = "ALTER TABLE books_v1 ADD Column volume VARCHAR(50), ADD Column author VARCHAR(100), ADD Column edition VARCHAR(100);" | |
19 $result_alter = mysql_query($query); | |
20 | |
21 while ($row = mysql_fetch_assoc($result)) { | |
22 // insert row into books_v1 table | |
23 echo $row['volume'].$row['author'].$row['edition'].$row['books_id']; | |
24 | |
25 $query_update = "UPDATE books_v1 SET `volume`='".$row['volume']."', `author`='".$row['author']."',`edition`='".$row['edition']."' WHERE `id`='".$row['books_id']."'"; | |
26 | |
27 $result_update= mysql_query($query_update); | |
28 if (!$result_update) { | |
29 echo json_encode("error"); | |
30 | |
31 } | |
32 } | |
33 */ | |
34 return; | |
35 } | |
36 | |
37 } | |
38 | |
39 | |
40 | |
41 ?> |