HTML interesse |
|
ik krijg deze foutmelding de namen krijg ik wel te zien
Notice: Undefined index: letter in /home/sintpiet/public_html/leden.php
<?php
include("config.php");
$letter = $_GET['letter'];
$aantal_leden = 25;
if(isset($_GET['sorteren']))
{
switch($_GET['sorteren'])
{
case "naam": $sorteer = "naam"; break;
case "email": $sorteer = "email"; break;
default: $sorteer = "naam"; break;
}
}
else
{
$sorteer = "naam";
}
if (isset($_GET['type']) && ($_GET['sorteren']))
{
$type = $_GET['type'];
if ($type == "ASC")
{
$type = "DESC";
}
else
{
$type = "ASC";
}
}
else
{
$type = "ASC";
}
$sql = "SELECT COUNT(*) AS `totaal` FROM `leden` WHERE `naam` LIKE '".addslashes($letter)."%'";
$res = mysql_query ($sql) or die (mysql_error ());
$list = mysql_fetch_assoc($res);
$aantal = $list['totaal'];
if(isset($_GET['id']) && (is_numeric($_GET['id'])))
{
$id = $_GET['id'];
}
else
{
$id = 0;
}
echo "<a href=\"".$_SERVER['PHP_SELF']."?letter=tekens\">#</a> | ";
for ($i = 65 ; $i < 91 ; $i++)
{
echo "<a href=\"".$_SERVER['PHP_SELF']."?letter=".urlencode(chr($i))."\">".chr($i)."</a> | ";
}
echo "<a href=\"".$_SERVER['PHP_SELF']."\">Alles</a>\n<br />\n<br />\n<hr\n><br />\n";
if($letter == "tekens")
{
$sql = "SELECT * FROM `leden` WHERE `naam` NOT REGEXP '^[a-z]' ORDER BY ".$sorteer." ".$type." LIMIT ".addslashes($id).", ".$aantal_leden."";
}
else
{
$sql = "SELECT * FROM `leden` WHERE `naam` LIKE '".$letter."%' ORDER BY ".$sorteer." ".$type." LIMIT ".addslashes($id).", ".$aantal_leden."";
}
$query = mysql_query($sql);
if(mysql_num_rows($query) == 0)
{
if(isset($_GET['letter']))
{
echo "</table>
<p style=\"text-align: center;\">Er zijn geen Leden gevonden met de letter ".$_GET['letter']."</p>";
}
else
{
echo "</table>
<p style=\"text-align: center;\">Er zijn nog geen leden toegevoegd!</p>";
}
}
else
{
?>
<table border="0" cellpadding="1" cellspacing="0" width="90%">
<tr>
<td><b><a href="<? echo $_SERVER['PHP_SELF']."?letter=".urlencode($letter)."&sorteren=naam&type=".urlencode($type);?>">Naam</a></b></td>
<td><b><a href="<? echo $_SERVER['PHP_SELF']."?letter=".urlencode($letter)."&sorteren=email&type=".urlencode($type);?>">Email</a></b></td>
<td><b>Toegevoegd op</b></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?
while($list = mysql_fetch_assoc($query))
{
echo "<tr>
<td>".ucfirst($list['naam'])."</td>
<td>".$list['email']."</td>
<td>".$list['toegevoegd']."</td>
</tr>";
}
echo "<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<hr>";
$paginas = $aantal / $aantal_leden;
if($paginas > 1)
{
echo "
<p style=\"text-align: center;\">
<br />
Pagina's ";
for ($i = 0; $i < $aantal; $i += $aantal_leden)
{
$pagina = $i / $aantal_leden + 1;
echo "<a href=\"".$_SERVER['PHP_SELF']."?letter=".urlencode($letter)."&id=".urlencode($i)."&sorteren=".urlencode($_GET['sorteren'])."&type=".urlencode($_GET['type'])."\">".$pagina." | </a> ";
}
}
}
?>
<?php include("config.php"); $letter = $_GET['letter']; $aantal_leden = 25; if(isset($_GET['sorteren'])) { switch($_GET['sorteren']) { case "naam": $sorteer = "naam"; break; case "email": $sorteer = "email"; break; default: $sorteer = "naam"; break; } } else { $sorteer = "naam"; } if (isset($_GET['type']) && ($_GET['sorteren'])) { $type = $_GET['type']; if ($type == "ASC") { $type = "DESC"; } else { $type = "ASC"; } } else { $type = "ASC"; } $sql = "SELECT COUNT(*) AS `totaal` FROM `leden` WHERE `naam` LIKE '".addslashes($letter)."%'"; $aantal = $list['totaal']; { $id = $_GET['id']; } else { $id = 0; } echo "<a href=\"".$_SERVER['PHP_SELF']."?letter=tekens\">#</a> | "; for ($i = 65 ; $i < 91 ; $i++) { echo "<a href=\"".$_SERVER['PHP_SELF']."?letter=".urlencode(chr($i))."\">".chr($i)."</a> | "; } echo "<a href=\"".$_SERVER['PHP_SELF']."\">Alles</a>\n<br />\n<br />\n<hr\n><br />\n"; if($letter == "tekens") { $sql = "SELECT * FROM `leden` WHERE `naam` NOT REGEXP '^[a-z]' ORDER BY ".$sorteer." ".$type." LIMIT ".addslashes($id).", ".$aantal_leden.""; } else { $sql = "SELECT * FROM `leden` WHERE `naam` LIKE '".$letter."%' ORDER BY ".$sorteer." ".$type." LIMIT ".addslashes($id).", ".$aantal_leden.""; } { if(isset($_GET['letter'])) { <p style=\"text-align: center;\">Er zijn geen Leden gevonden met de letter ".$_GET['letter']."</p>"; } else { <p style=\"text-align: center;\">Er zijn nog geen leden toegevoegd!</p>"; } } else { ?> <table border="0" cellpadding="1" cellspacing="0" width="90%"> <tr> <td><b><a href=" <? echo $_SERVER['PHP_SELF']."?letter=".urlencode($letter)."&sorteren=naam&type=".urlencode($type);? >">Naam</a></b></td> <td><b><a href=" <? echo $_SERVER['PHP_SELF']."?letter=".urlencode($letter)."&sorteren=email&type=".urlencode($type);? >">Email</a></b></td> <td><b>Toegevoegd op</b></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <? { <td>".ucfirst($list['naam'])."</td> <td>".$list['email']."</td> <td>".$list['toegevoegd']."</td> </tr>"; } <td> </td> <td> </td> <td> </td> </tr> </table> <hr>"; $paginas = $aantal / $aantal_leden; if($paginas > 1) { <p style=\"text-align: center;\"> <br /> Pagina's "; for ($i = 0; $i < $aantal; $i += $aantal_leden) { $pagina = $i / $aantal_leden + 1; } } } ?>
CREATE TABLE leden (
id TINYINT(11) NOT NULL AUTO_INCREMENT,
`naam` text,
`email` text,
'toegevoegd' text,
PRIMARY KEY (id) );
INSERT INTO leden VALUES ('','kevin','tom','kevin');
INSERT INTO leden VALUES ('','tom','kevin','tom');
|