[feladat @ 297]
authorpeter
Mon, 14 Jul 2008 16:19:30 +0000
changeset 188 4066e4c0de01
parent 187 ae77a8f97ee2
child 189 b918c891f81d
[feladat @ 297] Bugfix: removed the multirow insert syntax, which is only supported in PostgreSQL 8.2 and higher. Reported and patch by grin. This closes ticket:79.
inc/users.inc.php
--- a/inc/users.inc.php	Sat Jul 12 13:44:34 2008 +0000
+++ b/inc/users.inc.php	Mon Jul 14 16:19:30 2008 +0000
@@ -610,11 +610,10 @@
 	$perm_templ_id = $db->lastInsertId('perm_templ', 'id');
 
 	foreach ($details['perm_id'] AS $perm_id) {
-		$r_insert_values[] = "(" . $db->quote($perm_templ_id) . "," . $db->quote($perm_id) . ")";
+		$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES (" . $db->quote($perm_templ_id) . "," . $db->quote($perm_id) . ")";
+		$result = $db->query($query);
+		if (pear::iserror($response)) { error($response->getmessage()); return false; }
 	}
-	$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES " . implode(',', $r_insert_values) ;
-	$result = $db->query($query);
-	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
 	return true;
 }
@@ -646,11 +645,10 @@
 	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
 	foreach ($details['perm_id'] AS $perm_id) {
-		$r_insert_values[] = "(" . $db->quote($details['templ_id']) . "," . $db->quote($perm_id) . ")";
+		$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES (" . $db->quote($details['templ_id']) . "," . $db->quote($perm_id) . ")";
+		$result = $db->query($query);
+		if (pear::iserror($response)) { error($response->getmessage()); return false; }
 	}
-	$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES " . implode(',', $r_insert_values) ;
-	$result = $db->query($query);
-	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
 	return true;
 }