url as primary

master
Helge 2022-01-12 21:03:02 +01:00
parent 235f2188d2
commit 9dd44ababc
2 changed files with 3 additions and 4 deletions

View File

@ -23,6 +23,6 @@ if ($_POST["linkName"] != "" AND $_POST["linkUrl"] != "")
foreach ($db->getListReverse() as $link)
{
echo $link['link_id'].': <a href="'.$link['link_url'].'" target="_blank">'.$link['link_name'].'</a><br>';
echo '<a href="'.$link['link_url'].'" target="_blank">'.$link['link_name'].'</a><br>';
}
?>

View File

@ -24,8 +24,7 @@ class dbLinkHandler
// Tabelle link erstellen, falls nicht vorhanden
$sql = 'CREATE TABLE IF NOT EXISTS link (
link_id BIGINT(18) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
link_url VARCHAR(50) NOT NULL,
link_url VARCHAR(50) NOT NULL PRIMARY KEY,
link_name VARCHAR(100),
reg_date TIMESTAMP
)';
@ -59,7 +58,7 @@ class dbLinkHandler
{
// 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";
$sql = "SELECT * FROM link ORDER BY link_name DESC";
return $this->pdo->query($sql);
}