Mercurial > hg > LGToc
changeset 16:0bbf7b85d005
bug fixed: update section tables
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 15 Jul 2015 12:03:22 +0200 |
parents | e4c5f9cf66cb |
children | 2e6bf16b0be3 |
files | config/config.php edit_section_db.php |
diffstat | 2 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 {
--- 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