reverse List
parent
e56d62d2fa
commit
907d4c8f22
21
index.php
21
index.php
|
@ -53,17 +53,22 @@ class dbLinkHandler
|
|||
]);
|
||||
}
|
||||
|
||||
public function getLinkList()
|
||||
public function getListReverse()
|
||||
{
|
||||
// Mit verschachtelten Arrays optimieren!! Array schlüssel id enthält array mit schlüssel link_id, link_name, etc (repräsentiert datensatz)
|
||||
$list = array();
|
||||
$sql = "SELECT * FROM link ORDER BY link_id DESC";
|
||||
|
||||
return $this->pdo->query($sql);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
// Mit verschachtelten Arrays optimieren!! Array schlüssel id enthält array mit schlüssel link_id, link_name, etc (repräsentiert datensatz)
|
||||
$list = array();
|
||||
$sql = "SELECT * FROM link";
|
||||
foreach ($this->pdo->query($sql) as $row)
|
||||
{
|
||||
$list[$row['link_name']] = $row['link_url'];
|
||||
}
|
||||
|
||||
return $list;
|
||||
return $this->pdo->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,9 +79,9 @@ $link1=new Link("cloud.therealblue.de", "https://cloud.therealblue.de");
|
|||
|
||||
$db->saveLink($link1);
|
||||
|
||||
foreach($db->getLinkList() as $url => $name)
|
||||
foreach ($db->getListReverse() as $link)
|
||||
{
|
||||
echo '<a href="'.$url.'" target="_blank">'.$name.'</a><br>';
|
||||
echo $link['link_id'].': <a href="'.$link['link_url'].'" target="_blank">'.$link['link_name'].'</a><br>';
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue