# HG changeset patch # User Zoe Hong # Date 1436954602 -7200 # Node ID 0bbf7b85d00555d8689906bd8200a7372978496d # Parent e4c5f9cf66cbcce563941d740f4fe2ad627fc2f7 bug fixed: update section tables diff -r e4c5f9cf66cb -r 0bbf7b85d005 config/config.php --- a/config/config.php Wed Jun 24 17:18:09 2015 +0200 +++ b/config/config.php Wed Jul 15 12:03:22 2015 +0200 @@ -8,7 +8,7 @@ $mysql_server = "localhost"; $mysql_user = "root"; $mysql_password = "admin"; - $server_host = "http://localgazetteers-test.mpiwg-berlin.mpg.de/"; + $server_host = "http://localgazetteers.mpiwg-berlin.mpg.de/"; $lgserver_url = $server_host."LGServices/"; } else { diff -r e4c5f9cf66cb -r 0bbf7b85d005 edit_section_db.php --- a/edit_section_db.php Wed Jun 24 17:18:09 2015 +0200 +++ b/edit_section_db.php Wed Jul 15 12:03:22 2015 +0200 @@ -130,10 +130,13 @@ // -- Start Transaction -- mysql_query("BEGIN"); - $query="INSERT INTO sections_versions (version,editor,date,books_id) VALUES (".($version+1).",'".$editor."',NOW(),'".$bookId."')"; + $ver = $version+1; + + $query="INSERT INTO sections_versions (version,editor,date,books_id) VALUES (".$ver.",'".$editor."',NOW(),'".$bookId."')"; $result_versions=mysql_query($query); if(!$result_versions){ echo json_encode("Failed during inserting sections_version records."); // .mysql_error(); + } $versionId=mysql_insert_id(); @@ -152,7 +155,7 @@ // --- update to section_index table, which is the up-to-date section table --- $qry = ""; - if ($section_id == 0) { // section_id = 0 means it is a new record created by user + if ($section_id == 0 ) { // section_id = 0 means it is a new record created by user // insert new row to section_index table $qry = "INSERT INTO sections_index (name,books_id,section_after,start_page,end_page,level,split_from) VALUES ('".$name."','".$books_id."','".$section_after."',".$start_page. @@ -239,7 +242,7 @@ } // --- End Transaction --- - if ($result and $rst) { + if ($result and $rst and $result_versions) { mysql_query("COMMIT"); echo json_encode("Succeeded."); // important returning info to js