query using both id
and parent
This commit is contained in:
parent
f0cf0ebb48
commit
d5116689af
1 changed files with 10 additions and 2 deletions
|
@ -2055,7 +2055,11 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
|
||||||
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
||||||
$theiraddr = $contact['addr'];
|
$theiraddr = $contact['addr'];
|
||||||
|
|
||||||
$p = q("select guid from item where parent = %d limit 1",
|
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
|
||||||
|
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
|
||||||
|
// The only item with `parent` and `id` as the parent id is the parent item.
|
||||||
|
$p = q("select guid from item where parent = %d and id = %d limit 1",
|
||||||
|
$item['parent'],
|
||||||
$item['parent']
|
$item['parent']
|
||||||
);
|
);
|
||||||
if(count($p))
|
if(count($p))
|
||||||
|
@ -2111,7 +2115,11 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
|
||||||
$theiraddr = $contact['addr'];
|
$theiraddr = $contact['addr'];
|
||||||
|
|
||||||
|
|
||||||
$p = q("select guid from item where parent = %d limit 1",
|
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
|
||||||
|
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
|
||||||
|
// The only item with `parent` and `id` as the parent id is the parent item.
|
||||||
|
$p = q("select guid from item where parent = %d and id = %d limit 1",
|
||||||
|
$item['parent'],
|
||||||
$item['parent']
|
$item['parent']
|
||||||
);
|
);
|
||||||
if(count($p))
|
if(count($p))
|
||||||
|
|
Loading…
Reference in a new issue