![]() |
AW: [PHP/MySQL] - commit klappt nicht
Hi!
Ja, da habe ich natürlich jetzt auf dem Schlauch gestanden. Danke dir fürs runterheben ;) Die augenscheinlich funktionierende Version sieht jetzt so aus:
PHP-Quellcode:
Vllt. magst du ja nochmal drüberschauen und sagen, ob es noch was zu verbessern gibt.
$db -> autocommit(false);
$db -> query("LOCK TABLES course_registrations WRITE"); $sql = $db -> prepare('UPDATE course_registrations SET active = NOT active WHERE participantId=? AND courseId=?'); $sql -> bind_param('ii', $participantID, $courseID); $sql -> execute(); if ($db -> commit() && $sql -> affected_rows == 1) { $sql -> close(); $sql2 = $db->prepare('SELECT active FROM course_registrations WHERE participantId=? AND courseId=?'); $sql2 -> bind_param('ii', $participantID, $courseID); $sql2 -> execute(); $sql2 -> bind_result($active); $sql2 -> fetch(); $sql2 -> close(); $db -> query("UNLOCK TABLES"); $db -> autocommit(true); $owner = getLeaderForCourseId($db, $courseID); sendMessage($db, $owner, $participantID, $active?20:21, $active?$langActivated:$langDeactivated, $_GET['cid']); return 1; } else { $sql -> close(); $db -> query("UNLOCK TABLES"); $db -> autocommit(true); return 0; } Liebe Grüße, Frederic |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:22 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz