PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
for some reason my script will throw out all the users name at the beginning which i want it just show the alphabet :S but here is where i think the problem is at
<?php
echo '<center>';
// This function makes the alphabetic list which the links.
function drawAddressList() {
$seperator = "-";
// Loop through all 26 characters.
for ($i = 1; $i <= 26; $i++) {
$letter = chr($i + 64);
echo $seperator . "<a href='{$_SERVER['PHP_SELF']}?pages=letter&letter={$letter}'><font class=\"txt\">{$letter}</font></a>";
}
echo $seperator . '<br />';
}
// This function gets a parameter or the default.
function getParm($VariableName, $Default = '') {
return (isset($_GET[$VariableName])) ? $_GET[$VariableName] : $Default;
}
drawAddressList();
echo '<br>';
$letter = $_REQUEST['letter'];
$sql = mysql_query("SELECT * FROM users WHERE user_name like '$letter%'");
while ($row = mysql_fetch_array($sql)) {
echo '<a href="index.php?pages=data&user_name='.$row['user_name'].'"><font class=\"txt"\ color=\"red"\>'.$row['user_name'].'</font></a><br>';
}
echo '</center>';
?>
that is so when a letter is selected it shows the users under each letter like if you selected S it would show Smack and every other user that name begins with S