$sql = 'UPDATE faq_entries SET '.$parentpart.' header = \''.encodeNoHTMLWithBB($header).'\', body = \''.encodeNoHTMLWithBB($body).'\' WHERE id = '.$faqentry;
mysql_query($sql);
}
function moveUp($faqentry){
$entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id < '.$entry['id'].' order by id desc LIMIT 1';
$qry = mysql_query($sql);
$entry2 = mysql_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste
return;
}
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2);
while($row = mysql_fetch_assoc($qry2)){
$ids[] = $row['id'];
}
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
}
function moveDown($faqentry){
$entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id > '.$entry['id'].' order by id asc LIMIT 1';
$qry = mysql_query($sql);
$entry2 = mysql_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste
return;
}
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2);
while($row = mysql_fetch_assoc($qry2)){
$ids[] = $row['id'];
}
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
}
function getChildren($faqentry){
$sql = 'Select * from faq_entries where parent = '.$faqentry.' order by id asc';