Skip to content

Commit

Permalink
Fix use of RETURNING Id which isn't supported in all mysql. Use dbIns…
Browse files Browse the repository at this point in the history
…ertId instead.
  • Loading branch information
Isaac Connor committed Sep 15, 2023
1 parent 5c9f051 commit 4410757
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions web/ajax/tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
ajaxResponse(array('response'=>$dbFetchResult));
break;
case 'createtag' :
$sql = 'INSERT INTO Tags (Name, CreatedBy) VALUES (?, ?) RETURNING Id';
$sql = 'INSERT INTO Tags (Name, CreatedBy) VALUES (?, ?)';
$values = array($_REQUEST['tname'], $user->Id());
$result = dbFetchAll($sql, NULL, $values);
$r = $result[0];

$sql = 'SELECT * FROM Tags WHERE Id = ?';
$values = array($r['Id']);
$values = array(dbInsertId());
$dbFetchResult = dbFetchAll($sql, NULL, $values);

ajaxResponse(array('response'=>$dbFetchResult));
Expand Down

0 comments on commit 4410757

Please sign in to comment.