Jump to content

Recommended Posts

Problem: I have the alphabetical navigation done and it displays and when I test this in a browser it will change the $Key in the URL field of the browser but what it won't do is just display the titles of the anime that start with the letter that is the key letter.

[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>iAnime Downloads</title>
<link href="Styles/basic.css" rel="stylesheet" type="text/css">
<link href="Styles/nav.css" rel="stylesheet" type="text/css">
<link href="Styles/menu.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
</head>

<body>
<div id="wrapper">
<div id="titlebar"><img src="Images/ban.png"></div>
<div id="nav">
<ul>
<li><a href="home.php">Home</a></li>
    <li><a href="downloads.php">Downloads</a></li>
    <li><a href="forum.php">Forums</a></li>
    <li><a href="support.php">Support</a></li>
    <li><a href="ianime.php">iAnime</a></li>
</ul>
</div>
<div id="top"><img src="Images/top.png"></div>
<div id="main content">
<div id="alphabet">
<?php
$Key = $_REQUEST['Key'];

if (!$Key) {
  $ASCII= 65; # uppercase (+32 for lowercase)
  $i = 1;
  while ($i < 27) {
    $Char = chr($ASCII);
    echo("<a href='?key=$Char'>$Char</a>");
    if($i < 26) {
    echo(" - ");
    }
    $i++;
    $ASCII++;
  }
} else {
  $SQL = sprintf("SELECT `anime_name` FROM `Videos` WHERE `anime_name` LIKE `%s*`", $Key);
}
?>
</div>
<div id="list"><center>
<?php require_once('Connections/connectDB.php'); ?>
<?php
mysql_select_db($database_connectDB, $connectDB);
$query_Recordset1 = "SELECT anime_name, type FROM Videos WHERE anime_name LIKE '$Key%' ORDER BY anime_name ASC";
$Recordset1 = mysql_query($query_Recordset1, $connectDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<br>
<table width="375" border="0">
  <tr bgcolor="#FF00FF">
    <td width="81"><span class="style2">Type</span></td>
    <td width="284"><span class="style2">Name</span></td>
  </tr>
  <?php do { ?>
  <tr>
      <td><?php echo $row_Recordset1['type']; ?></td>
      <td><?php echo $row_Recordset1['anime_name']; ?></td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>

</center>
</div>
</div>
<div id="bottom">
<div id="word">
&copy; <?php echo date('Y'); ?>
</div>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/22652-need-help-displaying-certain-selection/
Share on other sites

first of all your gonna need an ASCII Table to understand this, www.google.com/search?q=ascii+table

[code]
<?php
$Key = $_REQUEST['key'];

if (!$Key) {
  $ASCII= 65; # uppercase (+32 for lowercase)
  $i = 1;
  while ($i < 27) {
    $Char = chr($ASCII);
    echo("<a href='?key=$Char'>$Char</a>");
    $i++;
    $ASCII++;
  }
} else {
  $SQL = sprintf("SELECT `bla` FROM `blaTable` WHERE `bla` LIKE `%s*`", $Key);
  # pass $SQL to the database
}
?>
[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.