diff models/home.php @ 51:840cdb52f476 extractapp

add book_meta into file
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 26 Mar 2015 15:42:50 +0100
parents 886f43b26ee2
children 97c1e5102a22
line wrap: on
line diff
--- a/models/home.php	Thu Mar 19 09:53:26 2015 +0100
+++ b/models/home.php	Thu Mar 26 15:42:50 2015 +0100
@@ -7,11 +7,15 @@
     
     public function Test() {
 
-    	/* uncomment to do the merge
-    	// merge books table with books_info table
-    	$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";
     	
-    	$result = mysql_query($query);
+        return;
+    }
+    public function MergeBooksInfoToBooks() {
+        /* uncomment to do the merge
+        // merge books table with books_info table
+        $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";
+        
+        $result = mysql_query($query);
         if (!$result) {
             return json_encode("Failed during selecting books, books_info table.");
         }
@@ -19,19 +23,20 @@
         $result_alter = mysql_query($query);
 
         while ($row = mysql_fetch_assoc($result)) {
-        	// insert row into books_v1 table
-        	echo $row['volume'].$row['author'].$row['edition'].$row['books_id'];
+            // insert row into books_v1 table
+            echo $row['volume'].$row['author'].$row['edition'].$row['books_id'];
             
             $query_update = "UPDATE books_v1 SET `volume`='".$row['volume']."', `author`='".$row['author']."',`edition`='".$row['edition']."' WHERE `id`='".$row['books_id']."'";
-				      
+                      
             $result_update= mysql_query($query_update);
             if (!$result_update) {
                 echo json_encode("error");
 
             }
         }
-		*/
+        */
         return;
+
     }
     
 }