function alpha($eid) { global $module_name, $prefix, $db; echo "<center>" . _ENCYSELECTLETTER . "</center><br><br>"; $alphabet = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); $num = count($alphabet) - 1; echo "<center>[ "; $counter = 0; $eid = intval($eid); while (list(, $ltr) = each($alphabet)) { $ltr = substr("{$ltr}", 0, 1); $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM " . $prefix . "_encyclopedia_text WHERE eid='{$eid}' AND UPPER(title) LIKE '{$ltr}%'")); if ($numrows > 0) { echo "<a href=\"modules.php?name={$module_name}&op=terms&eid={$eid}&ltr={$ltr}\">{$ltr}</a>"; } else { echo "{$ltr}"; } if ($counter == round($num / 2)) { echo " ]\n<br>\n[ "; } elseif ($counter != $num) { echo " | \n"; } $counter++; } echo " ]</center><br><br>\n\n\n"; encysearch($eid); echo "<center>" . _GOBACK . "</center>"; }
function alpha($eid) { global $prefix, $db; echo '<center>' . _ENCYSELECTLETTER . '<br /><br />[ '; $result = $db->sql_query("SELECT UPPER(SUBSTRING(title,1,1)) AS abet FROM " . $prefix . "_encyclopedia_text WHERE eid='{$eid}' GROUP BY abet ORDER BY abet"); while (list($ltr) = $db->sql_fetchrow($result)) { $ltr = urlencode($ltr); echo " <a href=\"" . getlink("&op=terms&eid={$eid}&ltr={$ltr}") . "\">{$ltr}</a> "; } echo ' ]</center><br /><br />'; encysearch($eid); echo '<center>' . _GOBACK . '</center>'; }